spoj#CRZYSMKR. Crazy Smoker
Crazy Smoker
The "BHAI Group" Of IIIT Allahabad is Famous For Many Things,Leading In Every Field Of College Activity
So One Day The Leader Of Bhai Group decided to smoke C(N) cigarettes each day:
- F(N) = 34^N+ (30 x N) + 32
- C(N) = F(N) mod (11), where x mod (y) is the remainder obtained by diving x by y.
But Bhai Group's Leader's Girlfriend wants that he doesn't smoke any cigarette, so she made modifications:
- F(N) = 34^N+ (30 x N) + (32 + M)
- C(N) = F(N) mod (11)
Edit 1 : Time Limit Set To .100s
Problem Credits : IIIT Allahabad HE Club
Input
First line of each test case is an integer T, total number of test cases. Next T lines contains a single integer N.
Output
Print the minimum value of M in single line for each test case.
Constraints
1 <= T <= 10^6
1 <= N <= 10^18
Example
Input:2 1 2Output:3 6Explaination :
For N = 1 F(N) = 34 + 30 + 32 = 96 So, M = 3 Now, C(N) = 99 mod(11) = 0 For N = 2 F(N) = 1156 + 60 + 32 = 1248 So, M = 6 Now, C(N) = 1254 mod(11) = 0