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:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    def make_factorial_table(size, mod):
        '''
        fact_mod[i] は i! % mod を表す。fact_mod[0] ~ facto_mod[size] まで計算可能なテーブルを返す
        >>> make_factorial_table(20, 10**9+7)
        [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 227020758, 178290591, 674358851, 789741546, 425606191, 660911389, 557316307, 146326063]
        '''
        fact_mod = [1] * (size + 1)
        for i in range(1, size + 1):
            fact_mod[i] = (fact_mod[i - 1] * i) % mod
        return fact_mod
    
    n = ii()
    fact = make_factorial_table(n, mod)
    print(fact[n])



if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(p)

Submission status: Accepted

Solution code:
N = int(input())
power = 1
for i in range(N):
    power*=i+1
    power%=1000000007
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 *= i
    ans %= 10 ** 9 + 7
print(ans)

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())
DIV=10**9+7
s=1
for i in range(1,n+1):
    s=(s*i)%int(DIV)
print(s)

Submission status: Accepted

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

resolve()

Submission status: Accepted

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

print(p)

Submission status: Accepted

Solution code:
N = int(input())
R = 10 ** 9 + 7
power = 1

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

print(power)

Submission status: Accepted

Solution code:
N = int(input())

class Mint:
    
    MOD = 10**9+7
    
    def __init__(self, x=0):
        self.x = (x%self.MOD + self.MOD) % self.MOD
    
    def __iadd__(self, other):
        self.x += other.x
        if self.x >= self.MOD:
            self.x -= self.MOD
        return self
    
    def __isub__(self, other):
        self.x += self.MOD - other.x
        if (self.x >= self.MOD):
            self.x -= self.MOD
        return self
    
    def __imul__(self, other):
        self.x *= other.x
        self.x %= self.MOD;
        return self;
    
    def __add__(self, other):
        ans = Mint(self.x)
        ans += other
        return ans
        
    def __sub__(self, other):
        ans = Mint(self.x)
        ans -= other
        return ans
    
    def __mul__(self, other):
        ans = Mint(self.x)
        ans *= other
        return ans
    
    def __pow__(self, n):
        if n == 0:
            return Mint(1)
        a = self.__pow__(n >> 1)
        a *= a
        if n&1:
            a *= self
        return a
    
    def inv(self):
        return self**(self.MOD-2)
    
    def __ifloordiv__(self, other):
        self *= other.inv()
        return self
    
    def __floordiv__(self, other):
        ans = Mint(self.x)
        ans //= other
        return ans
        
        
def Main(N):
    ans = Mint(1)
    for i in range(1, N+1):
        ans *= Mint(i)
    return ans.x
    
print(Main(N))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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


if __name__ == '__main__':
    main()

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:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = inputI()

print(kaijo(N))

Submission status: Accepted

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

INF = 10**9 + 7
n = int(input())
result = 1

for x in range(1, n+1):
    result = result * x % INF

print(result)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    def COMinit(n,MOD):
        fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
        fac[0]=fac[1]=1
        finv[0]=finv[1]=1
        inv[1]=1
        for i in range(2,(n+1)):
            fac[i]=fac[i-1]*i%MOD
            inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
            finv[i]=finv[i-1]*inv[i]%MOD
        return fac,finv,inv
    
    fac,finv,inv=COMinit(N,MOD)
    
    def COM(n, k, MOD=MOD):
        if n<k or n<0 or k<0:
            return 0
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD
    
    print(fac[N])

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(power)

Submission status: Accepted

Solution code:
ans = 1
for i in range(1,int(input())+1):
  ans *= i
  ans %= 10**9+7
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%(10**9+7))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())


k=0
ans=1
w=10**9+7

for i in range(n):
  k = k+1
  ans*=k
  ans%=w

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())
print(math.factorial(n) % 1000000007)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: <encoding name> -*-

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

po = 1

for i in range(1,N+1):
    # i = 1, 2, 3, ... ,N
    po = po * i % 1000000007


print(po)

Submission status: Accepted

Solution code:
# B - Training Camp
# https://atcoder.jp/contests/abc055/tasks/abc055_b

MOD = 10 ** 9 + 7

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())
power = 1
mod = 10**9 + 7
for i in range(n):
    power = power * (i+1)
    power %= mod
print(power)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#B

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

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

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    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 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().split())

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

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

n = I()

mod = 10**9 + 7

import math

ans = math.factorial(n)
print(ans%mod)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

mod = int(1e9)+7

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


print(ans)

Submission status: Accepted

Solution code:
M = 10**9+7

def factorial(n):
    f = 1
    for i in range(1,n+1):
        f = f*i%M
    return f

def comb(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    return perm(n,k)*inverse(factorial(k))%M

def mcomb(n,k):
    return comb(n+k-1,k)

def perm(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    p = 1
    for i in range(n-k+1,n+1):
        p = p*i%M

    return M

def inverse(a):
    return pow(a,M-2,M)
  
print(factorial(int(input())))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(math.factorial(N)%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import copy
import re
mod = 10**9+7

n = int(input())
neko = math.factorial(n)
print(neko%mod)

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())
n = 1000000007
p = 1
for i in range(1, N + 1):
    p *= i
    p %= n
print(p)

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 *= i
    ans %= 1000000007

print(ans)

Submission status: Accepted

Solution code:
from functools import lru_cache
import sys

sys.setrecursionlimit(1000000)

N = int(input())

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

Solution code:
import sys
import math
import bisect

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

import math
print(math.factorial(int(input())) % 1000000007)

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
mod = 10**9 +7
ans = reduce(lambda total, x: total * x % mod, range(1, n+1))

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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 factorial


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc055/tasks/abc055_b
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:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    print(math.factorial(N)%MOD)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc055/tasks/abc055_b

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回だけトレーニングする
import numpy as np
N = int(input())

# パワー
power = 1

# i回目のトレーニングを終えるとパワーが
# i倍されます。
# 答えの値は非常に大きな値になることがあるので
# 10**9+7で割ったあまりを出力

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

Submission status: Accepted

Solution code:
import math

N = int(input())

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

print(power)

Submission status: Accepted

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

answer=1
for i in range(2,N+1):
  answer*=i
  answer%=MOD

print(answer)

Submission status: Accepted

Solution code:
n = int(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())
x = 1
for i in range(1,n+1):
    x=(i*x)%((10**9+7))
print(x)

Submission status: Accepted

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

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())
pwr = 1
for i in range(1,n+1):
  pwr *= i
  if pwr>10**9+7:
    pwr = pwr%(10**9+7)
print(pwr%(10**9+7))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
print(math.factorial(N)%(10**9+7))

Submission status: Accepted

Solution code:
N=int(input())
import math
power=math.factorial(N)
print(power%(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())
import math
print((math.factorial(N)) % (10 ** 9 + 7))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
c = 1
t = 1
while t <= n:
  c = (c*t)%(10**9+7)
  t += 1
print(c)

Submission status: Accepted

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

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:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())

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

ret = power % (10 ** 9 + 7)
# 出力
print(ret)

Submission status: Accepted

Solution code:
ans = 1
MOD = 10**9 + 7

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
from sys import stdin
import math


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = math.factorial(N)%(10**9+7)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

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

print(ans)