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
2016-05-07 19:43:55 sharad mahajan
think with factorial
2016-04-10 14:10:42 kamran siddique
Not an Easy Trick at all !!!!!
2015-02-14 21:45:09 beginner
AC in first go :) try to find the pattern !
2015-01-21 02:20:45 DIWAKAR BHARDWAJ
very easy trick
2015-01-21 02:20:45 Minsuk Kim
lol took me a while to figure out the general formula hmmm
2015-01-21 02:20:45 deepika
[removed. Don't provide answers and explanations in the comments section.]

Last edit: 2014-11-07 20:04:18
2015-01-21 02:20:45 ISHANI
my AC complexity is O(N)
so don't worry about 10^18
2015-01-21 02:20:45 Kanish_The_Vista
tricky question but weak test cases
2015-01-21 02:20:45 Akash Gupta
whats the sequence ?
2015-01-21 02:20:45 TCony
1 line in ruby, 36 bytes

Last edit: 2014-02-13 08:47:58
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.