LGIC - LOGIC

Given a sequance of natural numbers.

Find N'th term of this sequence.

a1=2, a2=4, a3=11, a4=36, a5=147, a6=778 ... ... ... ... aN.

Input

 

Only one natural number 7<=N<20.

Output

One natural number. N'th term of the sequence.

Example

Input:
10
Output:
3629814

Added by:Azat Taryhchiyev
Date:2012-02-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:KG Regional Contest

hide comments
2015-01-21 02:20:45 dbz
all calculations comes in lld
whts the hell is this?????????
i got acc???????
2015-01-21 02:20:45 dbz
question is misguiding
2015-01-21 02:20:45 张翼德
The question sucks!!! Don't pay attention at the range :/
2015-01-21 02:20:45 nikoo28
spending too much time on this problem will only confuse you further and further...
HINT: the large range of N is just an illusion... ;)
2015-01-21 02:20:45 Pranshul Agarwal
Value of n is such that a(n)<=2^64 ;)
2015-01-21 02:20:45 eliminator
7<=N<=65 ;)
2015-01-21 02:20:45 Amit Gupta
weak testcases?
2015-01-21 02:20:45 Ajey Golsangi
If N is 10^18, the output len is > (10^9) !!!
2015-01-21 02:20:45 akb
how can some python function reduce time for a non O(lg n) function...
2015-01-21 02:20:45 Shubham
I don't think it can be solved in sublinear time and the limits on N are certainly not correct.

Last edit: 2012-07-28 08:50:15
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.