FIBSUM - Sum of Fibonacci numbers

no tags 

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

hide comments
Mitch Schwartz: 2013-11-30 17:26:59

The real top score is 37 in Bash by Nabb at http://www.spoj.com/SHORTEN/ranks/FIBSUM/ .

Aditya Pande: 2013-11-30 17:26:59

got it in 84b in AWK
81b in RUBY

Last edit: 2012-12-26 08:12:22
Sourabh Singh: 2013-11-30 17:26:59

@HWK can u tell me ppl who got ac in c use scanf/printf or there is some smaller way to i/o ??? plz...

Last edit: 2012-03-19 20:10:12
Paras Sharma: 2013-11-30 17:26:59

stuck at 116 in perl :'(

Edit: reached 118 with python also. Can't decrease size any further. I guess there is some trick for this.

Last edit: 2012-02-19 10:24:54
Allada Revanth Kumar: 2013-11-30 17:26:59

uffh.....152 in python :( please help me

Last edit: 2012-01-30 06:14:29
HWK: 2013-11-30 17:26:59

@Wakarimasen lol: You can reach 57 bytes.

Grandmaster: 2013-11-30 17:26:59

:'( for me solution in c++ seems impossible ..

HWK: 2013-11-30 17:26:59

@XeRon!X: 40 Bytes. Not awk but Bash.
Nabb reached 39 bytes. Shinh could also but obviously he ignored a special trick.

XeRoN!X: 2013-11-30 17:26:59

@HWK, what's your best solution. If i am allowed to ask -> Is it using awk?

Last edit: 2011-04-15 04:25:01
HWK: 2013-11-30 17:26:59

@.:: Debanjan ::.: The algo of calculating the sums is okay. Thus your Python-solution is almost the same as my own. But some people have optimized the calculation of the fibs.
The same holds for C.

Re(debanjan):Thank you very much :-)

Last edit: 2011-04-17 11:01:48

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