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 MR. BEAN
My first python code :)
2015-01-21 02:20:45 (Tjandra Satria Gunawan)(曾毅昆)
@numerix: thanks, now 58B with built in function ;)
2015-01-21 02:20:45 numerix
@Tjandra: You can solve it with less than 60 bytes ...
2015-01-21 02:20:45 (Tjandra Satria Gunawan)(曾毅昆)
only 79 characters needed to code the solution in python 3 (79B) ;)
2015-01-21 02:20:45 :D
I would say O(N) will most certainly pass.
2015-01-21 02:20:45 numerix
Please open it for more/all languages.
Edit: It's done, thanks.

Last edit: 2012-02-21 09:36:07
2015-01-21 02:20:45 [Rampage] Blue.Mary
O(N) solution CAN pass.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.