Problems
Sum of powers 2
Sum of powers 2
Find the sum $(1^1 + 2^2 + 3^3 + .... + n^n)~mod~m$.
\InputFile
Two positive integers $n$ and $m~(n, m \le 10^6)$.
\OutputFile
Print the value of the sum modulo $m$.
Input example #1
4 100
Output example #1
88