fork download
  1. from math import *
  2. F = [0] * (10 ** 6 + 1)
  3. def init():
  4. F[0] = 1
  5. for i in range(1 , 10 ** 6 + 1):
  6. F[i] = F[i - 1] * i
  7. F[i] %= (10 ** 9 + 7)
  8.  
  9.  
  10. if __name__ == '__main__':
  11. init()
  12. t = int(input())
  13. for i in range(t):
  14. n = int(input())
  15. print(F[n])
  16.  
  17.  
Success #stdin #stdout 0.41s 49200KB
stdin
5
11
6
8
10
13
stdout
39916800
720
40320
3628800
227020758