Note that $n^{0}=\binom{n}{0}, n^{1}=\binom{n}{1}, n^{2}=2\binom{n}{2}+\binom{n}{1}, n^{3}=6\binom{n}{3}+6\binom{n}{2}+\binom{n}{1}$. Thus the polynomial rewrites as $6 A\binom{n}{3}+(6 A+2 B)\binom{n}{2}+(A+B+2 C)\binom{n}{1}+D\binom{n}{0}$ which by the classification of integer-valued polynomials is divisible by $N$ always if and only if $6 A, 6 A+2 B, A+B+2 C, D$ are always divisible by $N$. We can eliminate $B$ and (trivially) $D$ from the system: it's equivalent to the system $6 A \equiv 0(\bmod N)$, $4 A-4 C \equiv 0(\bmod N), B \equiv-A-2 C(\bmod N), D \equiv 0(\bmod N)$. So we want $1^{2}$ times the number of $(A, C)$ with $A \equiv 0(\bmod N / 6), C \equiv A(\bmod N / 4)$. So there are $N /(N / 6)=6$ choices for $A$, and then given such a choice of $A$ there are $N /(N / 4)=4$ choices for $C$. So we have $6 \cdot 4 \cdot 1^{2}=24$ solutions total.
Let $N=30^{2015}$. Find the number of ordered 4-tuples of integers $(A, B, C, D) \in\{1,2, \ldots, N\}^{4}$ (not necessarily distinct) such that for every integer $n, A n^{3}+B n^{2}+2 C n+D$ is divisible by $N$.