FAST2 - Fast Sum of two to an exponent

There is people that really like to do silly thinks, one of them is sum the numbers from 20 to 2n, task is actually really simple, just do a ultra fast sum of term 20 to 2n.

Input

The first line starts with a number, T, which is the number of test cases, T lines will follow.

Each line contains the number "n".

0 ≤ n ≤ 500

Output

Output the sum from 20 to 2n MODULO 1298074214633706835075030044377087.

Example

Input:
3
0
1
2

Output: 1
3
7

Extra: TLE is equal to 0.15s


Added by:Rocker3011
Date:2012-04-14
Time limit:0.100s
Source limit:500B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own problem

hide comments
2022-03-08 18:09:36 vas14
The 500b restriction on the source file is just plain dumb.
2021-06-17 05:49:24
ez AC in one go
2021-03-15 00:55:30
500B file limit really? Implementing this in anything rather than python is literally impossible... Wrote handmade c++ functions for big number sum, mul, and sub in 1.5KB file size and cannot submit.. LOL, nvm it would pass anyway, but really unsatisfying moment...
2019-04-10 17:52:22
bitwise operations turn it easy. ;)
2018-06-01 15:15:14
Use pefixSum and precompute it so that u can retrive in O(1)
PythonRocks!
2015-11-03 16:10:58
python rocks...... :D
2015-10-21 09:30:43 Thotsaphon Thanatipanonda
Finally, Java can pass this problem!! :D
2015-10-01 16:29:10
Used sys library in python for input, input() function results in TLE, also modular exponentiation gives TLE .. A hint here : think of the fastest way to find 2 ** n, there is a very fast method to do this, and you do not require any exponent functions for this .. :)
2015-09-18 18:28:04
Lovely python ... u rock baby ;-)
2015-09-07 13:23:36 Parul Yadav
my first q in python
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.