# The Source Code

Colter is a designated spy on a mission. His mission is to dismantle a suitcase bomb on a train to Chicago. In order to do that, he has to break The Source Code. The Source Code is a $$2015\times 2015$$ table with buttons labelled from 1 to $$2015^2$$ in a snake-like fashion (see below for details). The code can be broken if and only if Colter has pushed all the button whose number $$x$$ satisfies the following conditions:

• $$a$$ is adjacent to $$x$$ from the top, and $$a \equiv 1 \pmod{2}$$
• $$b$$ is adjacent to $$x$$ from the right, and $$b \equiv 2 \pmod {3}$$
• $$c$$ is adjacent to $$x$$ from the bottom, and $$c \equiv 3 \pmod{4}$$
• $$d$$ is adjacent to $$x$$ from the left, and $$d \equiv 4 \pmod{5}$$.

How many button numbers $$x$$ does Colter have to push in order to break The Source Code?

Clarifications:

• Snake like fasion: For a $$n\times n$$ table $$(n>2)$$ containing $$n^2$$ buttons, each marked by a natural number from $$1$$ to $$n^2$$, the order the numbers are written is as follows: On the first line, the numbers $$1,2,\ldots,n$$ are in ascending order, whereas on the next line $$n+1,\ldots,2n$$ are in descending order. Here is an example of a $$3\times3$$ table:

Hint: Chinese remainder theorem is going to be useful in this.

×