LGIC - LOGIC

no tags 

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

hide comments
sharad mahajan: 2016-05-07 19:43:55

think with factorial

kamran siddique: 2016-04-10 14:10:42

Not an Easy Trick at all !!!!!

beginner: 2015-02-14 21:45:09

AC in first go :) try to find the pattern !

DIWAKAR BHARDWAJ: 2015-01-21 02:20:45

very easy trick

Minsuk Kim: 2015-01-21 02:20:45

lol took me a while to figure out the general formula hmmm

deepika: 2015-01-21 02:20:45

[removed. Don't provide answers and explanations in the comments section.]

Last edit: 2014-11-07 20:04:18
ISHANI: 2015-01-21 02:20:45

my AC complexity is O(N)
so don't worry about 10^18

Kanish_The_Vista: 2015-01-21 02:20:45

tricky question but weak test cases

Akash Gupta: 2015-01-21 02:20:45

whats the sequence ?

TCony: 2015-01-21 02:20:45

1 line in ruby, 36 bytes

Last edit: 2014-02-13 08:47:58

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