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
2020-08-16 22:16:51
AC in one go!
2020-07-31 14:48:37
3629814 is very close to 3628800 or 10!
2018-12-22 16:05:37
???????????
2018-09-08 12:28:52
its about factorials, but with weird offset.
Werry good task.

Last edit: 2018-09-08 12:32:04
2018-08-20 19:28:41
donno but I think it's something to do with factorial......... ;-)
2018-08-20 19:27:20
AC in 1 go!!!!
2018-07-16 13:33:04
@sharad mahajan, thanks :)
2018-06-07 17:22:45
Tricky One
PythonRocks
2016-11-13 11:41:22
3 lines of code ..akt rocks
2016-08-05 12:54:15
Interesting problem.
This problem is not bug funny.
Implementation is very easy. 255B in C++.
[This number of bytes is not exceed unsigned char maximum number :-) ]
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.