Is the competition finished? If it's not, then it's not fair to give help with this question. If it is, then you should ask if the solution is available.
And if you don't know anything about modular arithmetic, then it looks like the question is beyond your current level of mathematical knowledge. MHF is not designed to provide on-line lessons, it's up to you to learn about it yourself.
Thread closed (pm me if you want to discuss any of this).
Edit: Thread re-opened.