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: Time Limit Exceeded

Solution code:
n = int(input())

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

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

Submission status: Time Limit Exceeded

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

print(M)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(N):
	power = power * (i + 1)

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

Submission status: Time Limit Exceeded

Solution code:
#すぬけくんはトレーニングが好きなので N 回だけトレーニングすることにしました。
#すぬけくんのトレーニング開始前のパワーは 1 です。すぬけくんが i 回目のトレーニングを終えるとパワーが i 倍されます。
#すぬけくんが N 回トレーニングをしたあとのパワーを求めなさい。ただし、答えの値は非常に大きな値になることがあるので 109+7 で割ったあまりを出力してください。
N = int(input())
pow = 1
n1 = [x for x in range(1,N+1)]


for i in n1:
  pow = pow * i
  #print(pow)

pow1 = pow % (10**9 + 7)
print(pow1)

Submission status: Time Limit Exceeded

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

while n>1:
    ans *= n
    n -= 1
ans %= 10**9 + 7
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())


power = 1

for i in range(1,n+1):
    power *= i

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

Submission status: Time Limit Exceeded

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

n = int(raw_input())

power = 1

for i in range(n):
    power *= (i+1)

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

Submission status: Time Limit Exceeded

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

print(P%1000000007)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

P=1
for i in range(1,N+1):
   P=P*i

print(P%1000000007)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding:utf-8 -*-
n = int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python

n=int(raw_input().strip())

power=1
for i in range(1,n+1):
    power=power*i

print power%(10**9+7)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    N = int(input())
    ans = 1
    for i in range(1,N+1) :
        ans *= i
    ans %= 1000000007
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
m = 1
for var in range(int(raw_input())):
  m = m * (var + 1)
print(m%(1000000000+7))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = ans % (10 ** 9 + 7)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x = int(raw_input())
y = 1

for i in range(1, x + 1):
    y *= i

print y % (10**9+7)

Submission status: Time Limit Exceeded

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

ans = ans % ((10 ** 9) + 7)
print(ans)

Submission status: Time Limit Exceeded

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

print (power%1000000007)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8


def main():
    n = int(input())
    result = 1
    for i in range(2, n+1):
        result *= i
    print(result % 1000000007)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(raw_input())


N = []
for i in range(1,n+1):
	N.append(i)

N2 = 1
for N1 in N:
	N2 = N2 * N1

a = 10**9+7
N2 = N2%a

print N2

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p = 1
for i in range(N):
    p = p * (i + 1)
if p > (10**9 + 7):
    p = p % (10**9 + 7)
print(p)

Submission status: Time Limit Exceeded

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

N = input()
power = 1
for i in range(N):
    power = power*(i+1)

print(power%1000000007)

Submission status: Time Limit Exceeded

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

power = 1

for i in range(1,N+1):
 power *= i

print(power % P)

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
print reduce(mul,range(1,int(raw_input())+1),1)%(10**9+7)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(raw_input())
mod = pow(10,9) + 7
ans = 1
for i in xrange(1,n+1):
  ans = ans*i

print '{:d}'.format(ans%mod)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(raw_input())

print '{:d}'.format(math.factorial(n) % int(math.pow(10,9) + 7))

Submission status: Time Limit Exceeded

Solution code:
import functools
n = int(input())
p = functools.reduce(lambda x,y: x * y, range(1, n+1)) % (10**9 + 7)
print(p)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())


def main(n):
    pre = 1
    for i in range(1, n):
        pre = pre * i
    return pre * n % (pow(10, 9) + 7)


ans = main(n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
i = 1;
ans = 1;
tmp = 10 ** 9 + 7

for i in range(1,N+1):
	ans = ans * i

ans = ans % tmp
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())


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


def main(n):
    ans = calc(n)    
    return ans


ans = main(n)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(raw_input())
r = 1
for i in xrange(1,N+1):
    r = r * (i % 1000000007)
print r % 1000000007

Submission status: Time Limit Exceeded

Solution code:
N = int(raw_input())
r = 1
for i in range(1,N+1):
    r = r * (i % 1000000007)
print r % 1000000007

Submission status: Time Limit Exceeded

Solution code:
N = int(raw_input())
r = 1
for i in range(1,N+1):
    r *= i
print r % 1000000007

Submission status: Time Limit Exceeded

Solution code:
import sys
import math

n = int(sys.stdin.readline())

power = math.factorial(n)

print power % (long(1e+9) + 7)

Submission status: Time Limit Exceeded

Solution code:
import sys

n = int(sys.stdin.readline())

power = 1L
for i in range(n):
    power = power * (i+1)

print power % (long(1e+9) + 7)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
import math
mod = 1000000007
a = int(raw_input())
ans = math.factorial(a) % mod
print ans

Submission status: Time Limit Exceeded

Solution code:
N = int(raw_input())
x = 1
for i in xrange(N):
    x *= i+1

print x%1000000007

Submission status: Time Limit Exceeded

Solution code:
N = int(raw_input())

pw = 1

for i in range(1,N+1):
    pw = pw * i

print pw % (10**9 + 7)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())


def calc(n):
    if n in (1, 2):
        return n
    else:
        pre = 1
        for i in range(1, n):
            pre = pre * i
        return pre * n % (pow(10, 9) + 7)


def main(n):
    ans = calc(n)    
    return ans


ans = main(n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 整数の入力
N = int(input())
# 計算1
p = 1
 
for num in range(1,N+1):
    p = p * num
    
# 計算2
temp = 10**9 + 7
ans = p % temp
 
# 出力
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
import math

a = int(raw_input())
ans = math.factorial(a)
ans = ans % (pow(10,9) + 7)
print ans

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#coding: UTF-8
N=int(input())
out=1
for i in range(1,N+1):
    out=out*i
print(out%(10**9+7))

Submission status: Time Limit Exceeded

Solution code:
def countPower():
    power = 1
    N = int(input())
    i = 1
    if 1<=N<=10**5:
        while i <= N:
            power = i*power
            i += 1
    return power % (10**9 + 7)


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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python

import math
import sys

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

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

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

Submission status: Time Limit Exceeded

Solution code:

N = int(input())
p = 1

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

print(p % 1000000007)

Submission status: Time Limit Exceeded

Solution code:
N=input()

r=1
for i in xrange(N):
    r=r*(i+1)

print r%(10**9 + 7)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
i = 1
power = 1
while i <= N:
    power = power * i
    i += 1
print(power%(10**9+7))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python

import sys

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

        power = 1
        for i in xrange(1, n + 1):
            power *= i

        print power % (10 ** 9 + 7)

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

Submission status: Time Limit Exceeded

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

a = p % (10**9 + 7)
print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = 1

i = 1
while(i <= N):
	P *= i
	i += 1

P %= (10**9+7)
print(P)

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
m = 10**9+7
sum = 1
for i in range(2,n+1):
    sum *= (i%m)

print(sum%m)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
import math

a = int(raw_input())
ans = 1
for i in range(1,a+1):
    ans = ans * i
ans = ans % (pow(10,9) + 7)
print ans

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

Submission status: Memory Limit Exceeded

Solution code:
from functools import lru_cache
import sys

sys.setrecursionlimit(1000000)

N = int(input())

@lru_cache(maxsize=None)
def cnt_power(ans, n, cnt):
    if cnt>n:
        return ans
    elif (ans*cnt) >= (10**9+7) :
        ans = ans*cnt % (10**9+7)
        cnt += 1
        return cnt_power(ans, n, cnt)
    else:
        ans = ans*cnt
        cnt += 1
        return cnt_power(ans, n, cnt)

print(cnt_power(1, N, 1))

Submission status: Memory Limit Exceeded

Solution code:
i,d=0,[1];exec("i+=1;d+=d[-1]*i%(10**9+7),;"*int(input()));print(d[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    n = int(input())
    mod = 10**9+7
    power=1

    for i in range(1,n+1):
        power*=i
        power%=mod
    print(power)

if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = 10 ** 9 + 7
ans = [1]
for i in range(1,n+1):
  ans.append((ans[-1]*i) % p)
print(ans[n])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


def answer(n: int) -> int:
    return math.factorial(n) % (10 ** 9 + 7)


def main():
    n = int(input())
    print(answer(n))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 1

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

b=math.factorial(a)
print(b%(10**9+7))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

mod = 1000000007

def solve():
    N = int(input())
    ans = math.factorial(N) % mod
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

power = 1
for i in range(1, N + 1):
    power *= i
    power %= mod

print(power)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(power)

Submission status: Accepted

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

Submission status: Accepted

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

print(res)

Submission status: Accepted

Solution code:
N = int(input())
ans = 1
mod = 1000000007

for i in range(1, N + 1):
    ans *= i
    ans %= mod

print(ans)

Submission status: Accepted

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

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N=int(input())
print(math.factorial(N) % (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:
n = int(input())
mod = 10**9+7
ans = 1
for i in range(1, n+1):
    ans = (ans * i) % mod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

power = 1

for n in range(1, N+1):
    power = power*n % 1000000007

print(power)

Submission status: Accepted

Solution code:
import re
import copy

def accept_input():
    N = input()
    return int(N)

N = accept_input()

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

Submission status: Accepted

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

Submission status: Accepted

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

power = 1
for i in range(1, N+1):
  power *= i
  power %= mod
  
print(power % mod)

Submission status: Accepted

Solution code:
N = int(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:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n = I()
ans = 1
for i in range(n):
    ans *= (i+1)
    ans %= mod
print(ans%mod)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from bisect import bisect_left,bisect_right
from math import sqrt,gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse=False):
    data.sort(key=lambda x:x[col],reverse=revese)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def mydictvaluesort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[1] )

def mydictkeysort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[0] )

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n = I()
mod = 10**9 + 7
ans = factorial(n)%mod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

MOD = 10**9 + 7
class Mint:
    def __init__(self, value=0):
        self.value = value % MOD
        if self.value < 0: self.value += MOD

    @staticmethod
    def get_value(x): return x.value if isinstance(x, Mint) else x

    def inverse(self):
        a, b = self.value, MOD
        u, v = 1, 0
        while b:
            t = a // b
            b, a = a - t * b, b
            v, u = u - t * v, v
        if u < 0: u += MOD
        return u

    def __repr__(self): return str(self.value)
    def __eq__(self, other): return self.value == other.value
    def __neg__(self): return Mint(-self.value)
    def __hash__(self): return hash(self.value)
    def __bool__(self): return self.value != 0

    def __iadd__(self, other):
        self.value = (self.value + Mint.get_value(other)) % MOD
        return self

    def __add__(self, other):
        new_obj = Mint(self.value)
        new_obj += other
        return new_obj
    __radd__ = __add__

    def __isub__(self, other):
        self.value = (self.value - Mint.get_value(other)) % MOD
        if self.value < 0: self.value += MOD
        return self

    def __sub__(self, other):
        new_obj = Mint(self.value)
        new_obj -= other
        return new_obj

    def __rsub__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj -= self
        return new_obj

    def __imul__(self, other):
        self.value = self.value * Mint.get_value(other) % MOD
        return self

    def __mul__(self, other):
        new_obj = Mint(self.value)
        new_obj *= other
        return new_obj
    __rmul__ = __mul__

    def __ifloordiv__(self, other):
        other = other if isinstance(other, Mint) else Mint(other)
        self *= other.inverse()
        return self

    def __floordiv__(self, other):
        new_obj = Mint(self.value)
        new_obj //= other
        return new_obj

    def __rfloordiv__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj //= self
        return new_obj

ans = Mint(1)
for i in range(1, N + 1):
    ans *= i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p = 10**9+7
N = int(input())
A = [1 for _ in range(N+1)]
for i in range(2,N+1):
    A[i] = (A[i-1]*i)%p
print(A[N])

Submission status: Accepted

Solution code:
n = int(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:
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()
# row = [int(input().rstrip()) for _ in range(n)]

def resolve():
    import sys
    input = sys.stdin.readline
    import functools
    import operator

    n = int(input().rstrip())

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

    print(ans)



if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import math

N = int(input())

p = 1
for i in range(2, N+1):
  p *= i
  p = p % (1000000000 + 7)
  
print(p)

Submission status: Accepted

Solution code:
import math

N = int(input())

print(math.factorial(N) % (1000000000 + 7))

Submission status: Accepted

Solution code:
N = int(input())

a =1
div = 10**9 +7

for n in range(1,N+1):
  a *= n
  if a>div :
    a = a%div

print(a)

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:
MOD=1000000007

N=int(input())
ans=1
for i in range(1,N+1):
    ans*=i
    ans%=MOD
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(calc)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int):
    p = 1
    for i in range(1,N+1):
        p = p * i % MOD
    print(p)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ctypedef long long LL
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
import os
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時 or コードテスト時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode

Submission status: Accepted

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

ctypedef long long LL
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: Accepted

Solution code:
mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。

from libcpp.vector cimport vector


ctypedef long long LL
cdef LL MOD = 10**9 + 7
cdef LL N = int(input())
cdef LL ans = 1
cdef vector[LL] ansls

cdef i
for i in range(2, N + 1):
    ans *= i
    ans %= MOD
    ansls.push_back(ans)
print(ans)
# print(type(ansls))

'''
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: Accepted

Solution code:
n = int(input())
mod = 7 + 10**9
ans = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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