Find the sum (1^1 + 2^2 + 3^3 + \ldots + n^n) \mod m.
Two positive integers n and m (n, m \le 10^6).
Print the value of the sum modulo m.
Example 1