FIBSUM - Sum of Fibonacci numbers

Given the ith (1<=i<=35) Fibonacci number Fi calculate the sum of the ith till i+9th number Fi+Fi+1+...+Fi+9 and the last digit of the i+246th one Fi+246.
Be careful: Your solution mustn't exceed 111 bytes. But rather half of it should be more than enough.
Score is source length.

Input

In the first line the number of testcases N<=100, then N lines with one positive integer i.

Output

One line with "Fi+Fi+1+...+Fi+9+last digit of Fi+246" for each i.

Example

Input:
2
1
35 Output: 146
1821381552

Added by:HWK
Date:2011-03-25
Time limit:1s
Source limit:111B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2013-11-30 17:26:59 :(){ :|: & };:
@HWK: Could you please check my solution and tell me if I have hit the optimum trick?
2013-11-30 17:26:59 HWK
@XeRon!X: Congratulation!
But that's what I said before. Therefore I've changed max of i and source limit. With i<=64 you wouldn't have done it.
By the way: My 100 bytes solution is almost identical to your 99.

Last edit: 2011-03-30 11:49:36
2013-11-30 17:26:59 XeRoN!X
I was wrong, can be solved in 99B in C :)
2013-11-30 17:26:59 HWK
@hallvabo: That's right. Changed.
@ADMIN: Why? For e.g. Python 140 bytes wouldn't be a challenge. You also can solve it in Ruby. I wrote a quick and dirty solution with 73 bytes.

Last edit: 2011-03-29 10:35:51
2013-11-30 17:26:59 germinating
can the source limit be increased to 140 bytes final :)
2013-11-30 17:26:59 Hallvard Norheim Bø
Example input line three (i=64) conflicts with the requirement 1<=i<=35.
2013-11-30 17:26:59 HWK
Sorry, I meant the source limit. I've corrected it.
@XeRon!X: In addition I've changed source limit to 111 and maximum of i to 35. So a solution in C is possible. I wrote one with 100 bytes. Now it's your turn. ;-)
@numerix: You're on a good way, but it could be better. My Python solution before publication requires 72 bytes, my best non-Python solution 41.
2013-11-30 17:26:59 XeRoN!X
Time limit is fine. I was referring to source limit only. Anyways, i'll try in some other language.
2013-11-30 17:26:59 HWK
Yes, difficult or impossible.
But my thoughts were:
1. With a bigger source limit the task wouldn't be a challenge.
2. C has an advantage in many SPOJ-tasks, why not here a disadvantage.

Last edit: 2011-03-28 18:44:04
2013-11-30 17:26:59 XeRoN!X
99B in C is very difficult. Consider to increase the limit.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.