eolymp
bolt
Try our new interface for solving problems
Problems

Sum of powers

Sum of powers

Find the value of the sum $(1^n + 2^n + 2 \cdot 3^n + 3 \cdot 4^n + 4 \cdot 5^n + .... + 99 \cdot 100^n) \mod m$. \InputFile Two positive integers $n$ and $m~(n, m \le 10^8)$. \OutputFile Print the value of the sum modulo $m$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
12345678 35242346
Output example #1
5447885
Author Michael Medvedev