Problem:


Score : 200 points

Problem Statement

Snuke loves working out. He is now exercising N times.

Before he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.

Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.

Constraints

1 ≤ N ≤ 10^{5}

Input

The input is given from Standard Input in the following format:

N

Output

Print the answer modulo 10^{9}+7.

Sample Input 1

3

Sample Output 1

6

After Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.

After Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.

After Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.

Sample Input 2

10

Sample Output 2

3628800

Sample Input 3

100000

Sample Output 3

457992974

Print the answer modulo 10^{9}+7.



Sample input:
3


Sample output:
6

Submission status: Accepted

Solution code:
cn = 10**9+7
def f(x, n):
    for i in range(n):
        x = (x*n)%cn
        n-=1
    return x

n = int(input())
pw = f(1, n)
print(pw)

Submission status: Accepted

Solution code:
N = int(input())

s = 1
for i in range(1, N+1):
    s *= i
    s %= 10**9 + 7
print(s)

Submission status: Accepted

Solution code:
#!/usr/bin/python

import math
import sys

def main(argv):
    for line in sys.stdin:
        n = int(line)

        answer = 737935835
        if n < 50000:
            answer = math.factorial(n)
        elif n > 50000:
            for i in xrange(50001, n + 1):
                answer = (answer * i) % (10**9 + 7)
        print answer % (10**9 + 7)

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

Solution code:
import math

def countPower():
    power = 1
    N = int(input())
    if 1<=N<=10**5:
        power = math.factorial(N)
    return power % (10**9 + 7)

if __name__=="__main__":
    print(countPower())

Submission status: Accepted

Solution code:
N=int(input())
inf=10**9+7

tmp=1
for i in range(1,N+1):
    tmp = (tmp*i)%inf
print(tmp)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = 1
for i in range(1, n + 1):
    a *= i
    a = a % (10 ** 9 + 7)

print(str(a))

Submission status: Accepted

Solution code:
mod = 1e9 + 7
n = int(input())
ans = 1
for i in range(1, n+1):
    ans = (ans * i) % mod
print("%.d"% ans)

Submission status: Accepted

Solution code:
n = int(input())
div = 10 ** 9 + 7

ans = 1
for i in range(2, n + 1):
    ans *= i
    ans %= div

print(ans)

Submission status: Accepted

Solution code:
#coding: UTF-8
import math
N=int(input())
out=math.factorial(N)
print(out%(10**9+7))

Submission status: Accepted

Solution code:
import math

N = int(input())

power = math.factorial(N)
ans = power % (10**9 + 7)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1

for i in range(1, n+1):
    ans *= i
    if ans > 10 ** 9 + 7:
        ans %= 10 ** 9 + 7

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
pwr = math.factorial(N)
print(str(pwr % 1000000007))

Submission status: Accepted

Solution code:
import sys
N = int(raw_input())
assert(1 <= N <= 1e5)

res = 1
mult = 1
for i in xrange(N):
    res *= mult
    res = res%(1e9 + 7)
    mult += 1
print int(res)

Submission status: Accepted

Solution code:
N = int(input())

d = 10 ** 9 + 7

if N <= 50000:
    P= 1
    for x in range(1, N+1):
        P *= x
elif N > 50000:
    P = 737935835
    for x in range(50001, N + 1):
        P *= x
    
print(P%d)

Submission status: Accepted

Solution code:
import math
n = int(input())
print(math.factorial(n)%int(10**9+7))

Submission status: Accepted

Solution code:
import math
N = int(input())
power = math.factorial(N)
print(power%(10**9+7))

Submission status: Accepted

Solution code:
import math

N=int(input())

pwr=math.factorial(N)

print(pwr%(10**9 + 7))

Submission status: Accepted

Solution code:
N = int(input())
start = 1
for i in range(1, N + 1):
    start *= i
    if start > 1E9 + 7:
        start = int(start % (1E9 + 7))
print(start)

Submission status: Accepted

Solution code:
import math

def range_prod(lo,hi):
    if lo+1 < hi:
        mid = (hi+lo)//2
        return range_prod(lo,mid) * range_prod(mid+1,hi)
    if lo == hi:
        return lo
    return lo*hi

def treefactorial(n):
    if n < 2:
        return 1
    return range_prod(1,n)
n = int(input())
m = 10**9+7
print(treefactorial(n%m)%m)

Submission status: Accepted

Solution code:
N = int(input())
m = 1
for i in range(2,N+1):
    m *= i
    m %= 1000000007
print(m)

Submission status: Accepted

Solution code:
import math



num = int(input())
input = math.factorial(num)

print(input % (10**9 + 7))

Submission status: Accepted

Solution code:
N = int(input())
import math
print(math.factorial(N)%(10**9+7))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from math import factorial
print(factorial(int(input()))%(10**9+7))

Submission status: Accepted

Solution code:
N = int(input())

p = 1
div = 10 ** 9 + 7

for i in range(1,N+1):
    p *= i
    p %= div

print(p)

Submission status: Accepted

Solution code:
def factorialMod(n, modulus):
    ans=1
    if n <= modulus//2:
        #calculate the factorial normally (right argument of range() is exclusive)
        for i in range(1,n+1):
            ans = (ans * i) % modulus
    else:
        #Fancypants method for large n
        for i in range(n+1,modulus):
            ans = (ans * i) % modulus
        ans = modinv(ans, modulus)
        ans = -1*ans + modulus
    return ans % modulus


print factorialMod(input(),10**9+7)

Submission status: Accepted

Solution code:
N = int(raw_input())
C = 10**9+7
Num = 1
for i in range(1, N+1):
	Num *= i
	Num %= C
print Num

Submission status: Accepted

Solution code:
# coding: utf-8
def getLnInputs():
    return input().split()


def getLnIntInputs():
    return list(map(int, getLnInputs()))


def main():
    N = getLnIntInputs()[0]
    power = 1
    for i in range(1, N + 1):
        power *= i
        power %= 1000000007

    print(power)
    return


main()

Submission status: Accepted

Solution code:
N = int(input())

res = 1
for n in range(1, N+1):
    res = (res * n)%(10**9+7)
print(res)

Submission status: Accepted

Solution code:
n = int(raw_input())
ans = 1
for x in xrange(1,n+1):
	ans*=x;
	ans%=(10**9+7)
print ans%(10**9+7)

Submission status: Accepted

Solution code:
from sys import stdin
from math import factorial

n = int(stdin.readline())

print(factorial(n) % 1000000007)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import math
N = int(input())
print(math.factorial(N)%((10**9)+7))

Submission status: Accepted

Solution code:
N = int(raw_input())
ans = 1
MOD = 10 ** 9 + 7
for i in range(1, N+1):
    ans *= i
    ans %= MOD
print ans

Submission status: Accepted

Solution code:
def calc(n):
    ret = 1
    for i in range(1,n+1):
        ret *= i
        ret = ret % (10**9+7)
    return ret

print(calc(int(input()))%(10**9+7))

Submission status: Accepted

Solution code:
n = int(input())

ans = 1

for i in range(n):
    ans *= (i + 1)
    ans %= (1000000000 + 7)

print(ans)

Submission status: Accepted

Solution code:
N = int(input().strip())
power = 1
MOD = 1000000007
for i in range(1, N+1):
	power = (power * i) % MOD
 
print(power)

Submission status: Accepted

Solution code:
N = int(input())
Ans = 1
for i in range(1,N+1):
    Ans = (Ans*i)%1000000007

print(Ans)

Submission status: Accepted

Solution code:
from  math import factorial

n = int(input())

print(factorial(n) % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    ans = 1
    for i in range(1, N + 1):
        ans *= i
        ans %= 10 ** 9 + 7
    print(ans % (10 ** 9 + 7))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;
using ll = long long int;
const ll MOD = 1000000007;

int main(){
    ll n;
    cin >> n;
    ll ans = 1;
    for(ll i = 2; i <= n; i++){
        ans *= i;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
print(math.factorial(int(input())))

Submission status: Runtime Error

Solution code:
import math
N=int(input())
print(math.factrial(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
from functools import reduce
MOD = 1_000_000_007
print(reduce(lambda a,b: a*b%MOD, range(1, int(input()))))

Submission status: Runtime Error

Solution code:
from functools import reduce
MOD = 1_000_000_007
print(reduce(lambda a,b: a*b%MOD, range(1, int(input()))))

Submission status: Runtime Error

Solution code:
mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True

ctypedef long long LL
import numpy as np
cimport numpy as cp
cdef LL MOD = 10**9 + 7
cdef LL N = int(input())
cdef LL ans = 1

cdef i
for i in range(2, N + 1):
    ans *= i
    ans %= MOD
print(ans)
'''
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    import os
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1
for i in range(1, n+1):
  ans *= i
print(ans/(10**9+7))

Submission status: Runtime Error

Solution code:
a=int(input())
b=1
for i in range(1,a+1):
  b=b*i
if b<1000000000:
  print(b)
else:
  print(((b/10000000000)*(10000000000))%1000000007)

Submission status: Runtime Error

Solution code:
N = int(input())
mod = int(10e9+7)
f = lambda n:1 if n==1 else n * f(n-1) % mod
print(f(N))

Submission status: Runtime Error

Solution code:
n = int(input())
start = 1
for i in range(2, n+1):
    start *= i
    start %= MOD
print(start)

Submission status: Runtime Error

Solution code:
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*i
  
  
print(ans%(10**9+7))

Submission status: Runtime Error

Solution code:
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%(10**9+7))

Submission status: Runtime Error

Solution code:
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%1000000007)

Submission status: Runtime Error

Solution code:
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%10000000007)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;

int main(){
  long long int n,i,ans=1;
  cin>>n;
  
  for(i=1;i<=n;i++)
  ans=(ans*i)%(10000000007);
  
cout<<ans<<endl;

Submission status: Runtime Error

Solution code:
s=int(input())
ans=1
for i in range(1,n+1):
  ans*=i
  
print(ans)

Submission status: Runtime Error

Solution code:
print(math.factorial(int(input()))%(10**9+7))

Submission status: Runtime Error

Solution code:
from decimal import Decimal

n = int(input())
training = 1
for i in range(1, n):
    training *= i
print(Decimal(training) % (10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
import math
n = int(input())
print(math.factrial(n) % (10**9 + 7))

Submission status: Runtime Error

Solution code:
n = int(input())
power = 1
for i in range(1,n+1):
    power *= i
    power = power % (10 ** 9 + 7))

print(power % (10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
import math
x = int(input())
a = 10*10*10*10*10*10*10*10*10+7
print(math.fanctional(x) % a)

Submission status: Runtime Error

Solution code:
import math
x = int(input())
a = 10*10*10*10*10*10*10*10*10+7
print(math.fanctional(x)%a)

Submission status: Runtime Error

Solution code:
import math
x = int(input())
a = 10*10*10*10*10*10*10*10*10+7
print(math.functional(x)%a)

Submission status: Runtime Error

Solution code:
import math
x = int(input())
y = 10*10*10*10*10*10*10*10*10 +7
print(math.functional(x)%y)

Submission status: Runtime Error

Solution code:
N = int(input())
def amari(n):
    if n==1:return 1
    return (n*amari(n-1)) % 1000000007
print(amari(N))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main(){
  long int n, i = 1;
  cin >> n;
  for(long int j = 1; j <= n; j++){
    i *= j;
    i %= MOD;
  }
  cout << i << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
number = input()
power = 1;

for i in range(number):
  power = power * i
  
print(power)

Submission status: Runtime Error

Solution code:
# coding: utf-8

n = int(N)

power = 1
for i in range(1, n+1):
    power *= i
    power = power % (10**9+7)

print(power)

Submission status: Runtime Error

Solution code:
N = int(input())
power = 1
for i in range(1:N+1):
  power *= i
 
print(power/1000000000+7)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(factorial.(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
l = np.arange(1,n+1)
print(np.pord(l)%(10**9+7))

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1
for i in range(1,n+1):
    ans=ans*i%(1e9+7)

print(int(ans)

Submission status: Runtime Error

Solution code:
FACTOR = 10 ** 9 + 7

num = 1
for i in range(1, N+1):
    num *= i
    k, r = divmod(num, FACTOR)
    num = r

k, r = divmod(num, FACTOR)
print(r)

Submission status: Runtime Error

Solution code:
#整数の入力
N = int(input())

ans = 1


for i in range(N):
  ans = ans * (i+1)
  
ans = ans/(10**9 + 7)
print(ans)

Submission status: Runtime Error

Solution code:
import math
a = int(input())
print(math.factorial(a) /( 10**9 + 7))

Submission status: Runtime Error

Solution code:
n=int(input())

def ans(n):
    if n==1:
        return 1
    else:
        return n*ans(n-1)
print(ans(n)%1000000007)

Submission status: Runtime Error

Solution code:
N = int(input())
div = 1e9+7
ans = 1
for i in range(1,N+1):
    ans*=i
print(ans%div)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print((math.factorial(N))/(10^9+7))

Submission status: Runtime Error

Solution code:
n = int(input())
import fractions
print(fractions.factorial(n)%(10**9+7))

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(math.factorial(N))
L=10**9+7
print(M%L)

Submission status: Runtime Error

Solution code:
import math
print(math.factorial(int(input))%(10**9 + 7))

Submission status: Runtime Error

Solution code:
import math
print(math.factorial(int(input)))

Submission status: Runtime Error

Solution code:
N = input()
sum=1

for i in range(1, N+1):
    sum=(sum*i)%1000000007

print(sum)

Submission status: Runtime Error

Solution code:
N = input()
sum=1

for i in range(1, N):
    sum=(sum*i)%1000000007

print(sum)

Submission status: Runtime Error

Solution code:
N=int(input())
import math
power=1
for i in range(0,n):
  power=power*(i+1)
print(power%(10**9+7))

Submission status: Runtime Error

Solution code:
N = int(input())
fact = 1
for integer in range(1,N+1):
    fact = fac * integer % 1000000007
print(fact)

Submission status: Runtime Error

Solution code:
N = int(input())
num = 1
for i in range(1, N+1):
    num *= i
    num %= 1_000_000_007
print(num)

Submission status: Runtime Error

Solution code:
#a,b=map(int,input().split())
n=int(input())
#s=input()
ans=1
for i in range(n):
  ans*=(n%mod)
  ans%=mod
print(ans)

Submission status: Runtime Error

Solution code:
#a,b=map(int,input().split())
n=int(input())
#s=input()
ans=0
for i in range(n):
  ans*=(n%mod)
  ans%=mod
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation



'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        #sqrt(n)+1以上は考えて約数はないので却下
        if n % k == 0:
            return False
            #割り切れたらFalse
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  # [1, 0, 3]

'''



########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp

def main():

    w=1
    j=0
    k=0
    dl=[]
    po=1
    n=int(input())
    #print(factorial(n))
    for i in range(1:n):
        po=po*(i)
    print(po%(10**9+7))
    #r=int(input())
    #dp= [[0]*3 for i in range(5)]#列　行
    #dp用の0の入ったやつ
    #dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
    #print(dp)＃初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
    DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
    exdp=np.zeros((3,4)) # ３×４の２次元配列を生成。2次元ならこう
    #dtypeは指定しないとfloatになる
    #for i in range(n):#ちょっとした入力に便利
    #    a, b = map(int, input().split())
        #dp[i][0] += [a]
        #これだとintとlistをつなぐことになって不適
    #    dp[i] += [a]
    #    dp[i] += [b]
        #これはうまくいく
        #やり方はいろいろあるということ
    #print(dp)


    "1行1つの整数を入力を取得し、整数と取得する"
    #number_list=list(map(int, input().split(" ")))#数字の時
    #print(number_list)
    "12 21 332 とか入力する時に使う"
    "1行に複数の整数の入力を取得し、整数として扱う"
    #brray=[list(map(int, input().split(" ")))for i in range(N)
    #print(brray)


    #s=input()
    #a=[int(i) for i in s]#int取るとstrでも行ける
    #print(a)
    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]#内包表記に慣れろ
    #print(pin_l)

    ls = ["a", "b", "c", "d", "e"]


    #print(ls[2:5])
    #スライスでの取得

    #print(ls[:-3])
    #一番左端から右から3番目より左まで取得

    #print(ls[:4:2])
    #スライスで1個飛ばしで取得
    #ないときは左端スタート
    #始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
    #print(ls[::2])
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:

import math
N = int(input())
print((math.factorial(N))/(10**9 + 7))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print((math.factorial(N)/(10**9 + 7)))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print((math.factorial(N)/(10**9 + 7))

Submission status: Runtime Error

Solution code:
N = int(input())
def fract(n):
    if n == 0:
        return 1
    elif n == 1:
        return n
    return n * fract(n-1)

res = fract(N) % 1000000007
print(res)

Submission status: Runtime Error

Solution code:
N = int(input())
def fract(n):
    if n == 1:
        return n
    return n * fract(n-1)
res = fract(N) % 1000000007
print(res)

Submission status: Runtime Error

Solution code:
N = int(input())
def fract(n):
    if n == 1:
        return n
    return n * fract(n-1)
res = fract(N) /(1000000007)
print(res)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(math.factorial(N)-math.factorial(N)/(10**9+7)*math.factorial(N))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(math.factrial(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(math.factorial(N) % (10**9+7)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(math.factorial(N)%(10**9+7)

Submission status: Runtime Error

Solution code:
n= int(input())
def fact_m(n, modulus=10**9+7):
    ans=1
    if n <= modulus//2:
        for i in range(1,n+1):
            ans = (ans * i) % modulus   
    else:
        for i in range(1,modulus-n):
            ans = (ans * i) % modulus
        ans = modinv(ans, modulus)

        if n % 2 == 0:
            ans = -1*ans + modulus
    return ans % modulus
print(fact_m(m))

Submission status: Runtime Error

Solution code:
def func(X):
    if X==1:
        return 1
    else:
        return X*func(X-1)
N=int(input())
print(func(N)%((10**9)+7))

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 1
for i in range(2,i+1):
  ans = ans * i % (10 ** 9 + 7)

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
def per(N):
    if N == 0 or N == 1:
        return 1
    else:
        return N * per(N-1)

print(per(N) % (10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
N = int(input())
def per(N):
  return N * per(N-1)

print(per(N) / (10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
import math
N=int(input())

print(math.factorical(N)%(10**+7))

Submission status: Runtime Error

Solution code:
import math

N=int(input())
print((math.factorical(N))%(10**9+7))

Submission status: Runtime Error

Solution code:
N = int(input())

def power(n):
    if n == 1:
        p = 1
    else:
        p = power(n-1) * n
    
    return p % (10**9 + 7)

print(power(N))

Submission status: Runtime Error

Solution code:
import math

n = int(input())
result = math.prod([i for i in range(1, n+1)])
print(result%(10**9+7))

Submission status: Runtime Error

Solution code:
import functools

N = int(input())
print(functools.reduce(lambda x, y: x * y % 1000000007, range(2, N+1)))

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1
for i in range(1,n+1):
  ans *= i
  ans %= mod
print(ans)

Submission status: Runtime Error

Solution code:
def nn(n):
    if n==0:
        return 1
    else:
        return n*nn(n-1)

n=int(input())
ans=nn(n)%100000007
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
import math
print(math.factorial(n)/(10**9+7))

Submission status: Runtime Error

Solution code:
n = int(input())

v = 1
for i in range(n):
  v = v*(i+1)
  
print(int(v%(1e9+7)))

Submission status: Runtime Error

Solution code:
n = int(input())
mod = 10**9 + 7
for i in range(1, n+1):
    ans *= i
    ans %= mod

print(ans)

Submission status: Runtime Error

Solution code:
from functools import lru_cache
@lru_cache(maxsize=None)
def fac(n, mod = 10**9+7):
    if n == 0:
        return 1
    else:
        return fac(n-1) * n % mod

n = int(input())
print(fac(n))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(math.factorial(N)/(10*9+7))

Submission status: Runtime Error

Solution code:
N = int(input())
import math
N! = math.factorial(N)
print(N!)

Submission status: Runtime Error

Solution code:
def factorial_power(n):
    if n == 0:
        return 1
    else :
        return n * factorial_power(n-1)
    
divisor = (10 ** 9) + 7

N = int(input())

print(factorial_power(N) % divisor)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
 
print(factrial(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
N = int(inport())
 
print(math.factorial(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
N = int(inport())
 
print(math.factrial(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
N = int(inport())

print(factrial(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
print(math.factorial(int(input()))%(10**9+7)

Submission status: Runtime Error

Solution code:
n = int(input())
power = 1

for i in range(1,n+1):
  power = power * i
  
print(powe r% (pow(10,9) + 7))

Submission status: Runtime Error

Solution code:
N = int(input())

import math
print(math.factorial(N) % big)

Submission status: Runtime Error

Solution code:
n = int(input())
r = 1
for i in range(n):
	r = r * (i + 1)
r = r / (10**9 + 7)
print(r)

Submission status: Runtime Error

Solution code:
import math
N=int(input)
print(math.factorial(N)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
a=int(input())
print(math.factorial(n)%(10**9+7))

Submission status: Runtime Error

Solution code:
a=int(input())
import math
print(math.factorial(n)%(10**9+7))

Submission status: Runtime Error

Solution code:
a=input()
import math
print(math.factorial(n)%(10**9+7))

Submission status: Runtime Error

Solution code:
N = int(input())
P = 1
for n in range(1,N + 1):
    P = P * n
print(P %% ((10**9) + 7))

Submission status: Runtime Error

Solution code:
N=int(input())
mod_lar = 10**9+7

def fact_mod(n):
    if n==1:
        return 1
    ans = int((n%mod_lar)*(fact_mod(n-1)%mod_lar))
    return ans

print(fact_mod(N))

Submission status: Runtime Error

Solution code:
n = int(input)

p = 1
for i in range(2, n+1):
  p = p*i%(10**9+7)
print(p)

Submission status: Runtime Error

Solution code:
import math 
n=int(input())
n =math.factorial(n)
m = (10**9) + 7
if n < m:
    prtint(n)
else :
    print(n%m)

Submission status: Runtime Error

Solution code:
import math
print(math.factorial(int(input())) /(10**9 +7))

Submission status: Runtime Error

Solution code:
def training(n):
    if n==1:
        return 1
    else:
        x=training(n-1)*n
        return x%mod
import sys
sys.setrecursionlimit(n+1)
n=int(input())
mod=10**9+7
print(training(n))

Submission status: Runtime Error

Solution code:
n=int(input())
ans=int(1)
for i in range(1,n+1):
	ans*=i
    ans%=1000000007
print(ans)

Submission status: Runtime Error

Solution code:
import math
n  = int(input())
 
ans = math.factional(n)
 
s = 10**9 + 7
 
print(ans % s)

Submission status: Runtime Error

Solution code:
import math
time = int(input())
p = math.factrial(time)
mod = p % (10**9+7)
print(mod)

Submission status: Runtime Error

Solution code:
N=int(input())
ans=1
for i in range(1,n+1):
    ans=(ans*i)%1000000007
print(ans%(10**9+7))

Submission status: Runtime Error

Solution code:
p = 1
for i in range(n):
  p = p*(i+1)%(10**9+7)
print(p)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <math.h>
int main(void){
    long int n;
    scanf("%ld", &n);

    long int ans = 1;
    long int tmp = pow(10, 9);
    for (long int i = 1; i <= n; i++){
        ans = ans * i;
    }
    printf("%ld\n", ans % (tmp + 7));

    return 0;
}

Submission status: Runtime Error

Solution code:
from  math import factorial
N = int(input())
N2=math.factorial(N)

print((N2)%(10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
N = int(input())
N2=math.factorial(N)

print(N2%1000000007)

Submission status: Runtime Error

Solution code:
ans=1
for i in range(int(iput())):
  ans*=i%(10**9+7)
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
mod=10**9+7
for i in range(1,n+1):
  ans=ans*i%mod
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
'''
import sys
sys.setrecursionlimit(1000000)
def kaijo(n):
    if n==0:
        return(1)
    else:
        n=n%(10**9+7)
        return(n*kaijo(n-1))
print(kaijo(n)%(10**9+7))
'''
ans=1
for i in range(1,n+1):
    ans*=i%(10**)+7
print(ans%(10**9+7))

Submission status: Runtime Error

Solution code:
n=int(input())
def kaijo(n):
    if n==0:
        return(1)
    else:
        return(n*kaijo(n-1))
print(kaijo(n)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
n = int(input())
print(math.factorial(n)%(10**9+7)