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 except: SCM qobi

hide comments
2014-05-19 11:20:40 Dominique VAILLANT
@Mitch: Up to now I thought to know very well Ruby, but... top world Mitch arrived!
2013-12-02 20:09:21 challenger
It's not my merit as I only shorten your codes by comparing them with each other. ;-)
2013-12-02 19:42:51 ওয়াসী (Wasi)
@challenger Wow! piotr you are incredible. It was tough to reach 41 byte. Will try again :)

Edit: Congratz! for the 32B awk solution(FIBON) too :D


Last edit: 2013-12-02 20:07:49
2013-11-30 17:27:57 challenger
@ওয়াসী (Wasi) - How about now? ;->
2013-09-06 18:56:32 challenger
@ওয়াসী (Wasi) - Well done again. Congrats for not giving up. :-)
2013-09-06 14:09:45 ওয়াসী (Wasi)
@challenger have a look at that. 41B in AWK! :D


Last edit: 2013-09-06 14:49:32
2013-07-10 15:22:45 Jander
@[]{} - It says right at the start of the description "Given the ith (1<=i<=35) Fibonacci".
2013-07-09 07:31:17 orange
what is max limit for i??
2012-02-26 02:36:32 Hallvard Norheim Bø
My Java solution is 208 bytes :(

Last edit: 2012-02-28 01:15:58
2011-04-08 11:42:26 HWK
@Piotr Kakol: You're right.
@Nabb: Try also http://www.spoj.pl/SHORTEN/problems/MERTENS/.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.