[b][size=medium][color=blue]此题乃师兄[ TT_last ]原创题!Orz膜拜一下[/color]
[align=center][color=green]a simple problem[/color][/align]
[color=blue]Problem Description[/color]
As we know , to caculate the sum of[img]http://dl.iteye.com/upload/attachment/531763/7269368e-96a6-3836-874b-6e43d1262fe8.jpg[/img]is hard if the n is large,because today is Valentines Day,to make this problem more easy ,you only need to caculate the sum mod c
[color=blue]Input[/color]
There are multiply testcases. Each testcase, there is one line contains two integers n,c;(1<=n <= 10^1000000,1<=c <=1000000000
[color=blue]Output[/color]
For each testcase, output an integer, denotes the result of the sum mod c
[color=blue]Sample Input[/color]
2 4
3 5
[color=blue]Sample Output[/color]
0
2
[color=blue]Author[/color]
TT_last
[img]http://dl.iteye.com/upload/attachment/531763/7269368e-96a6-3836-874b-6e43d1262fe8.jpg[/img]
[color=blue]计算这个的公式: n*2^(n-1)[/color]
高次取模降幂公式:[img]http://dl.iteye.com/upload/attachment/531761/b2c93169-8323-37f9-8dda-4999cb233343.jpg[/img]
Phi是欧拉函数
[/size][/b]
#include
#include
#include
#include
#include
//#include