#Lutece1418. Endless Iteration

Endless Iteration

Migrated from Lutece 1418 Endless Iteration

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

f(x)=2xf(x)=2^x。求f()(x)f^{(\infty)}(x)在模PP意义下的值。

Input

第一行一个整数TT(T100000T\leq 100000),表示数据组数

接下来TT行,每行一个整数PP(T2000000000T\leq 2000000000),表示模数.

Output

TT行,每行一个整数,表示模PP意义下的答案.

Samples

3
2
3
6
0
1
4

Note

f(D)(x)f^{(D)}(x)表示f(x)f(x)迭代了DD

Resources

2016 UESTC Training for Math