Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!

n=int(input())
a = [list(map(int, input().split())) for _ in range(3)]
#print(a[0][1])

def bin_upper(b):    
    pl=0
    pr=n-1
    
    while True:
        pc=(pl+pr)//2
        if a[0][pc]>=b and a[0][pc-1]<b:
            return pc
        elif a[0][pc]<b:
            pl=pc+1
            if pl>n-1:
                return n
        else:
            pr=pc-1
            if pr<0:
                return 0
                
def bin_lower(b):    
    pl=0
    pr=n-1
    
    while True:
        pc=(pl+pr)//2
        if a[2][pc]<=b and a[2][pc+1]>b:
            return pc+1
        elif a[2][pc]>b:
            pl=pc+1
            if pl>n-1:
                return n
        else:
            pr=pc-1
            if pr<0:
                return 0
"""
print(bin_upper(a[1][0]))
print(bin_lower(a[1][0]))
print(bin_upper(a[1][1]))
print(bin_lower(a[1][1]))
"""

cnt=0
for i in range(n):
    #val=bin_upper(a[1][0])
    #print(val)
    cnt+=bin_upper(a[1][i])*bin_lower(a[1][i])
print(cnt)


### FIXED CODE ###

import sys
input=sys.stdin.readline
from bisect import bisect_right, bisect_left
n=int(input())
a = [list(map(int, input().split())) for _ in range(3)]
a[0].sort()
a[2].sort()



cnt=0
for i in range(n):
    index_1 = bisect_left(a[0],a[1][i])
    index_2 = n-bisect_right(a[2],a[1][i])
    cnt+=index_1*index_2
print(cnt)
alp = str(input())
print "A" if alp.isupper() == True else print "a"

### FIXED CODE ###

alp = str(input())
print("A") if alp.isupper() == True else print("a")
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

x0, x1 = 0, 10**9
while x0 + 1  < x1:
  x = (x0+x1)//2
  suma=0
  for i in a:
    suma += (a//x)
    
  if suma > k:
    x0 = x
  else:
    x1 = x
print(x1)

### FIXED CODE ###

import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

x0, x1 = 0, 10**9
while x0 + 1  < x1:
  x = (x0+x1)//2
  suma=0
  for i in a:
    if i%x==0:
      suma+=(i//x)-1
    else:
      suma += (i//x)
    
  if suma > k:
    x0 = x
  else:
    x1 = x
print(x1)
s = list(input())
s = set(s).sort()
t = "abcdefghijklmnopqrstuvwxyz"

for c in t:
  if t in s:
    cotinue
  else:
    print(c)
    exit()

### FIXED CODE ###

s = list(input())
set(s)
s.sort()
t = list("abcdefghijklmnopqrstuvwxyz")

for c in t:
  if c in s:
    continue
  else:
    print(c)
    exit()

print("None")
#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())
x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append((b[i],c[i]))
    l[b[i]].append((a[i],c[i]))

d = [0] * (n+1)
check = False * (n+1)
check[k] = True
que = [k]

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] :
            que.append(i[0])
            check[i[0]] = True
            d[i[0]] = d[tmp] + i[1]
        else:
            pass

for i in range(q):
    ans = d[x[i]] + d[y[i]]
    print(ans)

### FIXED CODE ###

#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append([b[i],c[i]])
    l[b[i]].append([a[i],c[i]])

d = [0] * (n+1)
check = [0] * (n+1)
check[k] = 1
que = [k]
count = 1

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] == 0:
            que.append(i[0])
            check[i[0]] = 1
            d[i[0]] = d[tmp] + i[1]
            count += 1
        else:
            pass
    if count >= n:
        break

x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())
    print(d[x[i]] + d[y[i]])
x,y,z=map(int,input().split(" "))
if z-y-x>2(pow(x, 0.5)+pow(y, 0.5)):
	print("Yes")
else:
 
	print("No")

### FIXED CODE ###

import math
x,y,z=map(int,input().split(" "))

if (z-y-x)**2>4*x*y and z>y and z>x:
	print("Yes")
else:
 
	print("No")
n,a,b=map(int,input())
ans=0
for i in range(n):
  t=0
  i1=i
  for j in range(i):
    t+=i1%10
    i1//10
    if i1==0:
      break
  if a<=t<=b:
    ans+=i
print(ans)

### FIXED CODE ###

n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  t=i%10+i//10%10+i//100%10+i//1000%10+i//10000
  
  if a<=t<=b:
    ans+=i
print(ans)
N = int(input())
hList = [int(x) for x in input().split()]


def dfs(idx):
    if idx == N-1:
        return 0
    if idx < N-2:
        return min(abs(hList[idx] - hList[idx+1]) + dfs(idx+1), abs(hList[idx] - hList[idx+2]) + dfs(idx+2))
    elif idx < N-1:
        return abs(hList[idx] - hList[idx+1]) + dfs(idx+1)

print(dfs(0))

### FIXED CODE ###

N = int(input())
hList = [int(x) for x in input().split()]

#i番目まで飛んだ時点で一番小さい値、を計算していく
dp = [0, abs(hList[0] - hList[1])]
for i in range(2,N):
    dp.append(min(dp[i-2] + abs(hList[i-2] - hList[i]), dp[i-1] + abs(hList[i-1] - hList[i])))
print(dp[-1])
n = int(input())
for a in range(1, 10):
    for b in range(1, 10):
        if n == a * b:
            print('Yes')
            return
print('No')


### FIXED CODE ###

n = int(input())
for a in range(1, 10):
    for b in range(1, 10):
        if n == a * b:
            print('Yes')
            exit()
print('No')
# -*- coding: <encode name> -*-

r = int(input())
input(3 * (r ** 2))

### FIXED CODE ###

# -*- coding: <encode name> -*-

r = int(input())
print(3 * r * r)
N,K=map(input().split())
S=input()
S = S[:K] + S[K+1].lower() + S[K:]


### FIXED CODE ###

N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print("".join(S))
n = int(input())
a = []
a.append(int(i) for i in input().split())  
ans = 0
m = a[0]
for i in range(n-1):
  if m <= a[i+1]:
    ans += 1
    m = a[i+1]
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
m = a[0]
ans = 1
for i in range(1,n):
  if m <= a[i]:
    ans += 1
    m = a[i]
print(ans)
import sys
N = int(input())

time_lis = [0] * N
profit = [0] * N
for n in range(N):
    time_lis[n] = list(map(int, input().split()))
for n in range(N):
    profit[n] = list(map(int, input().split()))

ans = 0
always_zero = True
for n in range(N):
    count_1 = len([i for i in time_lis[n] if i == 1])
    tmp= max(profit[n][:count_1 + 1])
    ans += tmp
    if profit[n].index(tmp) != 0:
        always_zero = False
if always_zero:
    max_prof = sorted([item[0], item[1] for item in profit], key=lambda x: -x[1])
    print(ans - max_prof[0] + max_prof[1])
    sys.exit()
print(ans)

### FIXED CODE ###

n=int(input())
F=[[] for i in range(10)]
for i in range(n):
    for j,f in enumerate(list(map(int,input().split()))):
        if f:
            F[j].append(i)
P=[list(map(int,input().split())) for i in range(n)]
ans=-float("inf")
for i in range(1,1024):
    l=[0]*n
    for j in range(10):
        if i>>j&1:
            for k in F[j]:
                l[k]+=1
    t=0
    for j,k in enumerate(l):
        t+=P[j][k]
    ans=max(ans,t)
print(ans)
N = input()
if '7' in N:
    pritn('Yes')
else :
    print('No')

### FIXED CODE ###

N = input()
if '7' in N:
    print('Yes')
else :
    print('No')
N=int(input())
S = input()
left = -1
for i, s in enumerate(S):
    if s == '#':
        left = i
        break
if S[-1] == '#':
    sharps = S.split('.')
    t=len(sharps[-1])
    t2=len(sharps[-2])
    a=len(S.split('#')[-2])
    print(min(S.count('#')-t, S[left:].count('.'), S.count('#')-t-t2+a))
else:
    sharps = S.split('.')
    t=len(sharps[-2])
    a=len(S.split('#')[-1])
    print(min(S.count('#'), S[left:].count('.'), S.count('#')-t+a))


### FIXED CODE ###

N=int(input())
S = input()
w = [0]*(N+1)
b = [0]*(N+1)
for i, s in enumerate(S):
    if s=='.':
        w[i+1] = w[i]+1
        b[i+1] = b[i]
    elif s=='#':
        b[i+1] = b[i]+1
        w[i+1] = w[i]
ans = 10**20
for i in range(N+1):
    ans = min(ans, b[i]+w[N]-w[i])
print(ans)
N, M = map(int,input().split())
a = list(map(int,input().split()))
p = 10**9 + 7
a.insert(0, -1)
a.append(N+1)

def mod(n,p):
    return n % p

nk = [1]
for i in range(1,N+1):
    nk.append(mod((nk[-1] * i), p))

#ある数をAで割ったとき，その数をpで割ったときの余りを求めるのにかけるべき数を返す
def bunbo(A, p): 
    # p-2を2進数にする
    pp = p-2
    pb = list(str(format(pp, 'b')))
    # ひっくりかえす
    pb.reverse()
    # pbの要素の数lとして，A^1, A^2, A^4, A^8, ..., A^(2^l)をpで割った余りを求める
    lpp = [mod(A,p)]
    for _ in range(len(pb)-1):
        lpp.append(mod((lpp[-1] ** 2), p))
    # 必要なやつだけ足して，x=(A^(p-2)をpで割った余り)を求める
    x = 1
    for i in range(len(pb)):
        if pb[i] == '1':
            x *= lpp[i]
    return mod(x, p)
    
def nckp(a, b, c, p):
    # 0!, 1!, 2!, 3!, ..., n!をリストに入れる
    return mod((a * bunbo(b, p) * bunbo(c, p)),p)



for i in range(M-2):
    if a[i+1] - a[i] == 1:
        print(0)
        break
else:
    ans = 1
    for j in range(len(a)-1):
        if a[j] != N:
            up = a[j+1] - a[j] - 2
            step = 0
            for l in range(up//2 + 1):
                way = nckp(nk[up-l], nk[l], nk[up-2*l], p)
                step += way
            ans *= step
    print(mod(ans, p))

### FIXED CODE ###

P, Q, R = map(int,input().split())
l = [P+Q, Q+R, R+P]
print(min(l))
n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)

### FIXED CODE ###

n = int(input())
if n == 1:
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a+b)
a,b,c=map(int, input().split)

if a+b>=c:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a,b,c=map(int, input().split())
     
if a+b>=c:
  print("Yes")
else:
  print("No")
import copy
N = int(input())
As = []
for i in range(N):
    As.append(int(input()))
for j in range(N):
    instAs = copy.copy(As)
    instAs.pop(j)
    print(max(instAs))import copy
N = int(input())
As = []
for i in range(N):
    As.append(int(input()))
maxA = max(As)
instA = As.copy()
instA.remove(maxA)
secA = max(instA)
for i in range(N):
    if As[i] == maxA:
        print(secA)
    else:
        print(maxA)

### FIXED CODE ###

import copy
N = int(input())
As = []
for i in range(N):
    As.append(int(input()))
maxA = max(As)
instA = As.copy()
instA.remove(maxA)
secA = max(instA)
for i in range(N):
    if As[i] == maxA:
        print(secA)
    else:
        print(maxA)
H,A = map(int, input().split())
print(math.ceil(H/A))


### FIXED CODE ###

import math
H,A = map(int, input().split())
print(math.ceil(H/A))
import sys;raw_input = sys.stdin.readline
N = int(raw_input())
A = [None]*N
C = [0]*N
for i in xrange(N):
    A[i] = int(raw_input())
b = False
for i in xrange(1, N):
    if A[i] - A[i-1] > 1 :
        b = True
        break
if b or A[0] != 0:
    print -1
else:
    B = [0]*N
    ans = 0
    for i in xrange(1, N):
        val = B[i-1] + 1
        B[i] = val if val <= A[i] else 0
        C[i] = A[i] - B[i]
    for i in xrange(N-1, 0, -1):
        if B[i-1] == B[i]-1 :
            C[i-1] = min(C[i], C[i-1])
    C[0] = 0
    for i in xrange(1, N):
        if B[i] == B[i-1] + 1:
            assert C[i] >= C[i-1]
            C[i] = C[i-1] if A[i-1] + 1 >= B[i] + C[i-1] else min(C[i], A[i-1]-B[i])
            ans += (A[i] - B[i-1] - C[i] if B[i+1] == B[i] + 1 or B[i+1] <= 1 else A[i]) if i < N-1 else A[i] - B[i-1] - C[i]
        else:
            ans += A[i]
    print ans

### FIXED CODE ###

a, b, c, k = map(int, raw_input().split())
ans = ((-1)**k) *(a-b)
print ans if abs(ans) <= 10**18 else 'Unfair'
S=input()
if S[0]=="A" and S[2:-1].count("C")==1:
	index=s.index("C")
	S=S[1:index]+S[index+1:]
	if S.islower():
		print("AC")
	else:
		print("WA")	
else:
	print("WA")		

### FIXED CODE ###

S=input()
if S[0]=="A" and S[2:-1].count("C")==1:
	index=S.index("C")
	S=S[1:index]+S[index+1:]
	if S.islower():
		print("AC")
	else:
		print("WA")	
else:
	print("WA")
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1]*n
    self.rank = [0]*n
    
  def find_root(self, e):
    if self.root[e] < 0:
      return e
    else:
      r = self.find_root(self.root[e])
      self.root[e] = r
      return r
    
  def combine(self, e1, e2):
    root1 = self.find_root(e1)
    root2 = self.find_root(e2)
    if root1 == root2:
      pass
    elif self.rank[root1] < self.rank[root2]:
      self.root[root1] += self.root[root2]
      self.root[root2] = root1
      self.rank[root1] = self.rank[root2] + 1
    elif self.rank[root2] < self.rank[root1]:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] = self.rank[root1] + 1
    else:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] += 1
      
  def in_the_same_group(self, e1, e2):
      r1 = self.find_root(e1)
      r2 = self.find_root(e2)
      if r1 == r2:
        return True
      return False
  

NMK = input().split()
N = int(NMK[0])
M = int(NMK[1])
K = int(NMK[2])
uf = UnionFind(N)
from collections import defaultdict
friend_list = [0]*N
for _ in range(M):
  AB = input().split()
  A = int(AB[0])-1
  B = int(AB[1])-1
  uf.combine(A,B)
  friend_list[A] += 1
  friend_list[B] += 1

block_list = [0]*N
for _ in range(K):
  CD = input().split()
  C = int(CD[0])-1
  D = int(CD[1])-1
  if uf.in_the_same_group(C, D):
    block_list[C] += 1
    block_list[D] += 1

cnt = defaultdict(int)
ans = []
for i in range(N):
  cnt[i] = -uf.root[uf.find_root(i)] - 1 - friend_list[i] - block_list[i]
  ans.append(str(cnt[i]))

print(" ".join(ans))

### FIXED CODE ###

N = int(input())

if N % 2 == 0:
  print(N//2)
else:
  print(N//2+1)
X, Y = map(int, input())
print(X + Y // 2)

### FIXED CODE ###

X, Y = map(int, input().split())
print(X + Y // 2)
import sys
x, n = map(int, input().split())
lst = list(map(int, input().split()))
for i in range(250):
  if x - i not in lst:
    print(x + i)
      sys.exit()
  if x + i not in lst:
      print(x + i)
      sys.exit()

### FIXED CODE ###

import sys
x, n = map(int, input().split())
if n == 0:
  print(x)
  sys.exit()
lst = list(map(int, input().split()))
for i in range(250):
  if x - i not in lst:
    print(x - i)
    sys.exit()
  if x + i not in lst:
    print(x + i)
    sys.exit()
a = list(map(int,input().split()))
b = [input() for i in range(a[1])]
c = sorted(b)
print(c)

### FIXED CODE ###

a = list(map(int,input().split()))
b = [input() for i in range(a[0])]
c = sorted(b)
print("".join(c))
m = int(input())
n = int(input())
a = list(map(int,input().split()))

ans = m - sum(a)

if ans < 0:
  print(-1)
else:
  print(ans)
  
  

### FIXED CODE ###

m_n = list(map(int,input().split()))
m = m_n[0]
n = m_n[1]
a = list(map(int,input().split()))
 
ans = m - sum(a)
 
if ans < 0:
  print(-1)
else:
  print(ans)
from itertools import accumulate
N = int(input())
S = input()
ind1 = 0
for i, x in enumerate(S):
    if x == '#':
        ind1 = i
        break
num = 0
for i, x in enumerate(S[::-1]):
    if x == '.':
        num = i
        break
ind2 = N - num
s = S[ind1:ind2]
if s[0] == '.' or s[-1] == '#' or len(s) == 0:
    print(0)
else:
    a = s.split('.')
    b = s.split('#')
    aa = []
    bb = []
    for x, y in zip(a, b):
        if len(x) != 0:
            aa.append(len(x))
        if len(y) != 0:
            bb.append(len(y))
    d = [0] + list(accumulate(aa))
    e = [0] + list(accumulate(bb))
    p = d[-1]
    ls = []
    for i in range(min(len(d), len(e))):
        ls.append(e[i]+p-d[i])
    print(min(ls))

### FIXED CODE ###

import sys
from itertools import accumulate
N = int(input())
S = input()

if S == '.'*N or S == '#'*N:
    print(0)
    sys.exit()

ind1 = 0
for i, x in enumerate(S):
    if x == '#':
        ind1 = i
        break
num = 0
for i, x in enumerate(S[::-1]):
    if x == '.':
        num = i
        break
ind2 = N - num
s = S[ind1:ind2]
if len(s) == 0:
    print(0)
    sys.exit()

a = s.split('.')
b = s.split('#')
aa = []
bb = []
for x in a:
    if len(x) != 0:
        aa.append(len(x))
for x in b:
    if len(x) != 0:
        bb.append(len(x))
c = [0] + list(accumulate(aa))
d = [0] + list(accumulate(bb))
ls = []
for i in range(len(c)):
    ls.append(c[i] + d[-1] - d[i])
print(min(ls))
import sys

MAX = 1000000


def digit_sum(n, b):
    if n == 0:
        return 0
    else:
        return digit_sum(n // b, b) + n % b


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

    if n < s:
        print(-1)
        sys.exit()

    ans = -1

    for b in range(2, min(n + 1, MAX) + 1):
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    if not ans == -1:
        print(ans)
        sys.exit()

    if n + 1 <= MAX:
        print(-1)
        sys.exit()

    for p in reversed(range(MAX)):
        if (n - s) % p != 0:
            continue
        b = (n - s) / p + 1
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

MAX = 1000000


def digit_sum(n, b):
    if n == 0:
        return 0
    else:
        return digit_sum(n // b, b) + n % b


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

    if n < s:
        print(-1)
        sys.exit()

    ans = -1

    for b in range(2, min(n + 1, MAX) + 1):
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    if ans != -1:
        print(ans)
        sys.exit()

    if n + 1 <= MAX:
        print(-1)
        sys.exit()

    for p in reversed(range(1, MAX)):
        if (n - s) % p != 0:
            continue
        b = (n - s) // p + 1
        if b < 2:
            continue
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    if ans != -1:
        print(ans)
        sys.exit()

    if n == s:
        print(n+1)
        sys.exit()

    print(-1)


if __name__ == '__main__':
    main()
import sys
def main():
  if 'get_ipython' not in globals():  
    # For Subsession
    N,K = map(int, input().split())
    S = sys.stdin.readline
  else:
    # For Test
    # N = 5
    # K = 1
    # S = "00010"
    N = 14
    K = 2
    S = "11101010110011"
    # N = 1
    # K = 1
    # S = "1"
    
  SC = []
  i = 0
  if S[0] == "0":SC.append(0)
  while i < N :
    if S[i] == "0":
      j = S.find("1",i)
    else:
      j = S.find("0",i)
    if j == -1: j = N 
    cnt = j - i
    i = j
    SC.append(cnt)
    
  if 'get_ipython' in globals(): print(SC)
    
  i = 0
  lenSC = len(SC) - 1
  ans = 0
  while i <= lenSC:
    cnt = 0
    k = i + K * 2
    if k > lenSC:
      k = lenSC
    k += 1
    cnt = sum(SC[i:k])
    if ans < cnt:
      ans = cnt
    i += 2

  print(ans)

main()

### FIXED CODE ###

import sys
def main():
  if 'get_ipython' not in globals():  
    # For Subsession
    N,K = map(int, input().split())
    S = sys.stdin.readline()
  else:
    # For Test
    # N = 5
    # K = 1
    # S = "00010"
    # N = 14
    # K = 2
    # S = "11101010110011"
    # N = 1
    # K = 1
    # S = "1"
    N = 5
    K = 1
    S = "11111"
    
  SC = []
  i = 0
  if S[0] == "0":SC.append(0)
  while i < N :
    if S[i] == "0":
      j = S.find("1",i)
    else:
      j = S.find("0",i)
    if j == -1: j = N 
    cnt = j - i
    i = j
    SC.append(cnt)
    
  if 'get_ipython' in globals(): print(SC)
    
  SH = []
  cnt = 0
  for i in range(len(SC)):
    cnt += SC[i]
    SH.append(cnt)
  
  if 'get_ipython' in globals(): print(SH)
  
  lenSC = len(SC) - 1
  ans = 0
  for i in range(0,lenSC+1,2):
    k = i + K * 2
    if k > lenSC:
      k = lenSC
    if i != 0:
      cnt = SH[k] - SH[i-1]
    elif k == i:
      cnt = SH[k]
    else:
      cnt = SH[k] - SH[i]
    if ans < cnt: ans = cnt

  print(ans)

main()
import sys

while 1:
  try:
    a, b, c, d, e, f = map(int, raw_input().split())
    g = b / e
    x = (c - g * f) / (float(a) - g)
    y = (c - a * x) / float(b)
    print str(x) + " " + str(y)
  except: EOFError
    sys.exit()

### FIXED CODE ###

while 1:
    try:
        a, b, c, d, e, f = map(float, raw_input().split())
        x = (c * e - b * f) / (a * e - b * d)
        y = (f * a - c * d) / (a * e - d * b)
        if x == -0.000:
            x = 0.000
        if y == -0.000:
            y = 0.000
        print str('%.3f' % x) + " " + str('%.3f' % y)
    except:
        break
a = list(map(int,input().split())
a = sorted(a)
print(a[0]*a[1]/2)

### FIXED CODE ###

a = list(map(int,input().split()))
a = sorted(a)
print(int(a[0]*a[1]/2))
def fact(n):
    if n == 1:
        return n
    else:
        return n*fact(n-1)
    
n = int(input())
print(fact(n)%(10**9+7))

### FIXED CODE ###

import math
n = int(input())
print(math.factorial(n)%(10**9+7))
N = int(input())
if N == 3 or 5 or 7:
    print('Yes')
else:
print('No')

### FIXED CODE ###

N = int(input())
if N == 3 or N==5 or N==7:
    print('YES')
else:
    print('NO')
abc = sorted(list(int, input().split()))
print("Yes" if abc[0] + abc[1] == abc[2] else "No")

### FIXED CODE ###

abc = sorted(list(map(int, input().split())))
print("Yes" if abc[0] + abc[1] == abc[2] else "No")
a, b, c = map(int, raw_input().split())
if (b-a) or (c-b):
    print("YES")
else:
    print("NO")





### FIXED CODE ###

a, b, c = map(int, input().split())
if (b-a) == (c-b):
    print("YES")
else:
    print("NO")
from collections import deque
import sys
sys.setrecursionlimit(2000)
N, M = map(int, input().split())
graph = [[] for j in range(M)]
q = deque([])
depth_array = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

def bfs(graph, q, depth_array):
    # 終了条件
    if len(q) == 0:
        return depth_array

    cur_room = q.popleft()

    # キューに追加
    for r in graph[cur_room]:
        if depth_array[r] == -1: #未訪問なら
            q.append(r)
            depth_array[r] = depth_array[cur_room] + 1

    return bfs(graph, q, depth_array)
    
# init
q.append(0)
depth_array[0] = 0
depth_array = bfs(graph, q, depth_array)

mark_array = [-1 for i in range(N)]
#print(depth_array)

for room, depth in enumerate(depth_array):
    for node in graph[room]:
        if depth_array[node] + 1 == depth_array[room]:
            mark_array[room] = node
if -1 in mark_array[1:]:
    print("No")
else:
    print("Yes")
    for m in mark_array[1:]:
        print(m+1)

### FIXED CODE ###

s = input()
t = s[-1]
if t == '2' or t == '4' or t == '5' or  t == '7' or t == '9':
    print("hon")
if t == '0' or t == '1' or t== '6' or t == '8':
    print("pon")
if t == '3':
    print("bon")
from itertools import permutations
import numpy as np
N, M = map(int, input().split(" "))#N頂点M辺
mat = [[0] * n for _ in range(n)]
for _ in range(M):
    v1, v2 = map(int, input().split(" "))
    mat[v1 - 1][v2 - 1] = mat[v2 - 1][v1 - 1] = 1

count = 0
for line in permutations(np.arange(N - 1) + 2):
    vtxs = [1] + list(line)
    for i in range(N - 1):
        v1, v2 = vtxs[i], vtxs[i + 1]
        if mat[v1 - 1][v2 - 1] == 0:
            break
    else:
        count += 1
print(count)

### FIXED CODE ###

from itertools import permutations
import numpy as np
N, M = map(int, input().split(" "))#N頂点M辺
edges = []
for _ in range(M):
    edges += [list(map(int, input().split(" ")))]

count = 0
for line in permutations(np.arange(N - 1) + 2):
    vtxs = [1] + list(line)
    for i in range(N - 1):
        edge = sorted([vtxs[i], vtxs[i + 1]])
        if edge not in edges:
            break
    else:
        count += 1
print(count)