favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

# Sum of powers

Find the value of the sum (1n + 2n + 2 * 3n + 3 * 4n + 4 * 5n + .... + 99 * 100n) mod m.

#### Input

Two positive integers n and m (n, m108).

#### Output

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