peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def cmb(n, r, p):
    r = min(r, n - r)
    upper = 1
    for i in range(n, n - r, -1):
        upper = (upper * i) % p

    lower = 1
    for i in range(1, r + 1):
        lower = (lower * i) % p

    # フェルマーの小定理よりp素数ならupper**(p-2)は逆元
    return (upper * pow(lower, p - 2, p)) % p

mod = pow(10, 9) + 7
n, a, b = map(int, input().split())
ans = (pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod))%mod
print(ans)
# Judge status: Accepted
import fractions

N = int(input())
A = list(map(int, input().split()))

left = [0] * (N+1)
right = [0] * (N+1)
for i in range(N):
    left[i+1] = (fractions.gcd(left[i], A[i]))
    right[N-i-1] = (fractions.gcd(right[N - i],A[N - 1 - i]))

ans = 0
for i in range(N):
    ans = max(ans, fractions.gcd(left[i], right[i+1]))
    
print(ans)
# Judge status: Accepted
def main():
    s = list(map(int,input().split()))
    for i, n in enumerate(s):
        if n == 0:
            print(i+1)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
str= input().split(" ")
str.sort()
ans = str[0]+str[1]
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(lambda a: int(a) - 1, input().split()))

T = [A[:]]
for _ in range(64):
    prev = T[-1]
    T.append([prev[a] for a in prev])

now = 0
for d, P in enumerate(T):
    if ((1 << d) & K) > 0:
        now = P[now]
print(now + 1)
# Judge status: Accepted
A = input().split()
B = int(A[0])+int(A[1])+int(A[2])

if B >= 22 :
	print("bust")
else:
	print("win")
# Judge status: Accepted
n, m, k = map(int, input().split())

for i in range(n+1):
  for j in range(m+1):
    a = m*i + n*j - 2*i*j
    if a == k:
      print('Yes')
      exit()
print('No')
# Judge status: Wrong Answer
a, b = map(int, input().split())

# x = sorted([a, b, a - 1, b - 1], reverse=True)
# print(x[0] + x[1])

if a > b:
	print(a * (a - 1))
elif b > a:
  	print(b * (b - 1))
else:
	print(a + b)
# Judge status: Accepted
N = int(input())
ans = []
while N != 0:
    r = N % 2
    N = (N - r) // (-2)
    ans += [r]
print(''.join(map(str, ans[::-1])) if ans else 0)
# Judge status: Accepted
A,B = map(int,input().split())
S = input()

if len(S)==A+B+1 and S[A]=="-" and S.count("-")==1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[0]
for i in range(1, N):
    ans = (ans + v[i]) / 2
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())

if (a%2!=0) or (b%2!=0) or (c%2!=0):
  print(0)
elif (a == b ) and (b == c):
  print(-1)
else:
  def exchange(a,b,c):
    return (b+c)/2,(c+a)/2,(a+b)/2
  num = 0
  ans = 0
  while num  == 0:
    a,b,c = exchange(a,b,c)
    ans += 1
    for j in range(3):
      if [a,b,c][j] % 2 ==1:
        num = 1
  print(ans)
# Judge status: Accepted
import math
n = int(input())
l = list(map(int,input().split()))
cnt = 0

for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i] != l[j] and  l[j] != l[k] and  l[k] != l[i]:
        if abs(l[i] - l[j]) < l[k] and l[k] < l[i] + l[j]:
          cnt += 1        
    
print(cnt)
# Judge status: Accepted
a,b,x=map(int, input().split())
print("YES" if a+b>=x and a<=x else "NO")
# Judge status: Accepted
N=int(input())

r=[input() for i in range(N)]

print("AC x",r.count("AC"))
print("WA x",r.count("WA"))
print("TLE x",r.count("TLE"))
print("RE x",r.count("RE"))
# Judge status: Accepted
n = int(input())
c = len(str(n))
if c == 1:
    print(n)
else:
    for i in range(1,11):
        if int(str(i)+"9"*(c-1)) > n:
            print(9*(c-1)+(i-1))
            break
# Judge status: Wrong Answer
N=int(input())
print(N*800 - (N%15)*200)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))

l.sort()
j = [0]*(10**6+1)

for i in l:
    j[i] += 1
    if j[i] == 1:
        for k in range(2*i,10**6+1,i):
            j[k] += 100

print(j.count(1))
# Judge status: Wrong Answer
n, m = input().split()
n, m = int(n), int(m)

data = []

for _ in range(m):
    temp_p, temp_y = input().split()
    temp_p, temp_y = int(temp_p), int(temp_y)
    data.append([temp_p, temp_y])

data.sort()

result = []

for temp_data in data:
    result.append("{:0>6}".format(temp_data[0]) + "{:0>6}".format(temp_data[1]))

for s in result:
    print(s)
# Judge status: Accepted
n,k = map(int, raw_input().split())
print 0 if n % k == 0 else 1
# Judge status: Accepted
# -*- 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():
    S=list(input())
    S.sort()
    S=''.join(S)
    YesNo(S=='abc')
    

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
csf = [list(map(int, input().split())) for _ in range(N-1)]
ans = [None]*N
ans[-1] = 0
for i in range(N-1):
    now = 0
    for j in range(i,N-1):
        if now <= csf[j][1]:
            now = csf[j][1]
        else:
            t  = (now - csf[j][1] + csf[j][2]-1)//csf[j][2]
            now = csf[j][1] + t*csf[j][2]
        now += csf[j][0]
    ans[i] = now
[print(a) for a in ans]
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
dp = [0]*n

for i in range(1,n):
  d1 = dp[i-1] + abs(l[i] - l[i-1])
  if i > 1:
    d2 = dp[i-2] + abs(l[i] - l[i-2])
    if d1 > d2:
      d1 = d2
  dp[i] = d1
print(l,dp)
# Judge status: Accepted
def resolve():
	import math
	N, X, T = map(int, input().split())
	print(math.ceil(N/X)*T)
resolve()
# Judge status: Accepted
A, B, C = map(int, input().split())
if C >= A and C <= B:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
M = 10**6 + 5
cnt = [0 for _ in range(M)]

for i in A:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    
    j = i
    while j < M:
        cnt[j] += 1
        j += i
ans = 0
for i in A:
    if cnt[i] == 1:
        ans += 1
print(ans)
# Judge status: Wrong Answer
import sys
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1,0,-1):
  if H[i-1] - H[i] > 1:
    print('No')
    sys.exit()
  elif H[i-1] > H[i]:
    H[i-1] += 1
print('Yes')
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())  
if abs(b-a) <= d and abs(c-b) <= d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, K = map(int, input().split())

H_list = [i for i in map(int, input().split())]

sorted_H_list = sorted(H_list)

if N <= K:
	print("0")
elif K == 0:
	print(sum(sorted_H_list))
else:
	print(sum(sorted_H_list[:-K]))
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
v = LI()
v.sort()
ans = v.pop(0)

for i in v:
  ans = (ans+i)/2
print(ans)
# Judge status: Accepted
print(1 << int(input()).bit_length() - 1)
# Judge status: Accepted
def main():
    N=int(input())
    A=list(map(int,input().split()))
    if 0 in A:
      print('0')
      return
    p=1
    for i in A:
      p=p*i
      if p>1000000000000000000:
        print(-1)
        return
    print(p)    
main()
# Judge status: Accepted
s = input()
if 'W' in s and 'E' in s and 'N' in s and 'S' in s:
    print('Yes')
elif 'W' in s and 'E' in s and not 'N' in s and not 'S' in s:
    print('Yes')
elif not 'W' in s and not 'E' in s and 'N' in s and 'S' in s:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
W=list(map(int,input().split()))
l=[]
s=sum(W)
for i in range(N-1):
    x=abs(2*(sum(W[0:i+1]))-s)
    l.append(x)
print(min(l))
# Judge status: Accepted
def main():
    from math import ceil
    n, k, *a = map(int, open(0).read().split())
    ans = 1 + ceil((n - k) / (k - 1))
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
mod = 1000000007
n = int(input())
a = list(map(int, input().split()))

lap = 0
big = max(a)
while big > 0:
    big //= 2
    lap += 1

xor = [0 for _ in range(lap)]
for i in a:
    num = 0
    for j in range(lap):
        if i % 2 == 1:
            xor[num] += 1
        i //= 2
        num += 1

ans = 0
for i in range(lap):
    ans += pow(2, i, mod) * xor[i] * (n - xor[i]) % mod
    ans %= mod

print(ans)
# Judge status: Wrong Answer
N, K= [int(i) for i in input().split()]
Sn = [1] + [0 if i =="L" else 1 for i in input()] + [0]


init_happiness = 0
change_count = 0
for n in range(1, N+1):
  if Sn[n] == 0 and Sn[n] == Sn[n-1]:
    init_happiness += 1
  elif Sn[n] == 1 and Sn[n] == Sn[n+1]:
    init_happiness += 1
  if Sn[n] == 1 and Sn[n+1] == 0:
    change_count +=1

    
change2 = min(max(0, change_count -1), K)

change1 = change_count %  2 if change2 < K else 0
print(init_happiness + 2 * change2 + change1)
# Judge status: Accepted
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
  A -= 1
else:
  B -= 1
print(A, B)
# Judge status: Accepted
N,K = map(int, input().split())
H = [int(input()) for _ in range(N)]

H.sort()

ans = float("inf")
for i in range(N - K + 1):
    ans = min(ans, H[i + K - 1] - H[i])

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

A, B = map(int, input().split())

if A == B:
    print("Draw")
    exit()

if A == 1:
    print("Alice")
    exit()

if B == 1:
    print("Bob")
    exit()

if A > B:
    print("Alice")
else:
    print("Bob")
# Judge status: Accepted
# -*- coding:utf-8 -*-
#入力
s,t = map(str,input().split())

print(t+s)
# Judge status: Wrong Answer
print(" ".join(list(map(str,input().split()))))
# Judge status: Accepted
def main():
    N, L = (int(x) for x in input().split())
    azi = [L + i for i in range(N)]
    ans = sum(azi)
    if 0 not in azi:
        if azi[0] > 0:
            ans -= azi[0]
        else:
            ans -= azi[N-1]
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,m = map(int,raw_input().split())

def f(n,m):

	for d in range(2, int(m ** 0.5) + 1):
		if m % d == 0:
			if m / d >= n:
				return d		
				break

	return 1

print f(n,m)
# Judge status: Accepted
A, B, C = list(map(int, input().split()))

if A+B >= C:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
t = [0]
for i in range(n):
    t.append(t[i] + a[i])
t.pop(0)
p = t[-1]
m = 0
for i in range(n):
    if p // 2 <= t[i]:
        print(abs(sum(a[0:i+1]) - sum(a[i+1:n])))
        break
# Judge status: Wrong Answer
S = input()

s = list(S)
ss = list(reversed(S))

ans = 0
for i in range(len(S)):
    if s[i] != ss[i]:
        ans += 1

print(ans)
# Judge status: Accepted
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
m=99999999999999
for i in range(min(a),max(a)+1):
    k=0
    for j in a:
        k=k+(j-i)**2
    if k<m:
        m=k
print(m)
# Judge status: Accepted
import sys

d = int(sys.stdin.readline().rstrip())

def main():
    return 'Christmas' + ' Eve' * (25 - d)

if __name__ == '__main__':
    ans = main()
    print(ans)
# Judge status: Accepted
N = int(input())
A = []
for n in range(N):
    A.append(int(input()))
B = [0 for n in range(N)]
B[0] = A[0]
for n in range(N-1):
    B[n+1] = max(B[n], A[n + 1])
C = [0 for n in range(N)]
C[-1] = A[-1]
for n in range(N - 1):
    C[-n-2] = max(C[-n-1], A[-n - 2])
for n in range(N):
    if n == 0:
        print(C[1])
    elif n == N - 1:
        print(B[N - 2])
    else:
        print(max(B[n-1], C[n+1]))
# Judge status: Accepted
a, b = map(int, input().split())
ans = a+b
if ans % 2:
  print("IMPOSSIBLE")
else:
  ans //= 2
  print(ans)
# Judge status: Accepted
x=input()
z=''

for i in x:
  if i == '0':
    z= z+i
  elif i == '1':
    z= z+i
  elif i == 'B':
    z= z[:-1]

print(z)
# Judge status: Wrong Answer
import itertools
import math
import fractions

n,k = map(int,input().split())
ans = n
if k == 1 or n == 0 or n==k :
    print("0")
    exit()

if n > k:
    ans = n%k



while(1):
    
    ans = abs(ans-k)
    if ans == n:
        break
    if ans == 1 or 0:
        break
print(ans)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
p,q,r=0,0,0
for i in range(N):
  if a[i]%2==0:
    if a[i]%4==0:
      r+=1
    else:
      q+=1
  else:
    p+=1
if p-1<r:
  print('Yes')
elif p-1==r:
  if q==0:
    print('Yes')
  else:
    print('No')
else:
  print('No')
# Judge status: Accepted
N, R = map(int, input().split())
if N < 10:
    R += 100*(10-N)
print(R)
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    color = [0] * 9
    ans = 0
    for a in A:
        if a >= 3200:
            color[8] += 1
        else:
            color[a // 400] += 1

    mi = 0
    for c in color[:8]:
        if c > 0:
            mi += 1
    print(mi, mi + color[8])



    

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
s=list(map(int,input().split()))
s.sort()
if s[0]==s[1]==s[2]:
    print('1')
elif s[0]==s[1]!=s[2]:
    print('2')
else:
    print('3')
# Judge status: Accepted
s=input()
t=input()
f=True
for i in range(len(s)):
  if s[i]!=t[i]:
    f=False
    break
print('Yes' if f and len(s)+1==len(t) else 'No')
# Judge status: Wrong Answer
a = int(input())
sum = 0
for i in range(a):
    if i % 3 != 0 or i % 5 != 0:
        sum += i
    else:
        pass
print(sum)
# Judge status: Wrong Answer
X = int(input())

if X >=1800 and X <1900:
    print(1)
elif X >=1600 and X <=1799:
    print(2)
elif X >=1400 and X<=1599:
    print(3)
elif X >=1200 and X<=1399:
    print(4)
elif X >= 1000 and X <=1099:
    print(5)
elif X >= 800 and X <= 999:
    print(6)
elif X >= 600 and X <= 799:
    print(7)
elif X >= 400 and X <= 599:
    print(8)
# Judge status: Accepted
from math import floor
import numpy as np
inputs = input().split()
multiple = np.int64(inputs[0]) * np.float64(inputs[1])

multiple_str = str(multiple)
if '.' in multiple_str:
    ans = multiple_str.split('.')[0]
else:
    ans = multiple_str

print(ans)
# Judge status: Accepted
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))

b=sum(a)
if n<b:
    print("-1")
else:
    print(n-b)
# Judge status: Accepted
n = int(input())
s = input()
ans = 0
for i in range(1, n - 1):
    sf = set(s[:i])
    sb = set(s[i:])
    cnt = 0
    for j in sf:
        if j in sb:
            cnt += 1
    ans = max(ans, cnt)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = int(input())
a_list = list(map(int, input().split()))

ans_list = [0] * N
ans_text = ''
for i in range(N):
  # j の倍数が何個あるか
  j = N - i
  sum_j = sum(ans_list[j-1::j])
  if sum_j%2 != a_list[j-1]:
    ans_list[j-1] = 1
    ans_text += str(j) + ' '
    
    
print(sum(ans_list))
print(ans_text)
# Judge status: Wrong Answer
n=int(input())
print(1000*(n//500) + 5*((n//500)//5))
# Judge status: Accepted
N=int(input())
L=[2,1]
for _ in range(N-1):
    L.append(L[-1]+L[-2])
print(L[-1])
# Judge status: Wrong Answer
s = [int(input()) for i in range(3)]
target = s[2]
if s[0] >= s[1]:
  long = s[0]
  short = s[1]
else:
  long = s[1]
  short = s[0]
 
for i in range(short):
  if long * i >= target:
    print(str(i+1))
    break
# Judge status: Accepted
A,B = map(int,input().split())
ans = 0
for i in range(A,B+1):
    if str(i)==str(i)[::-1]:
         ans+=1
print(ans)
# Judge status: Wrong Answer
n = int(input())
x = [int(i) for i in input().split()]

ans = 1000000
for i in range(max(x)):
  l = 0
  for j in range(n):
    l += (x[j]-i)**2
  if ans > l:
    ans = l
    
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    p = A[i] + A[i+1]
    if(p - B[i] >= 0):
        ans += B[i]
        if(A[i] - B[i] < 0):
            A[i+1] = p - B[i]
    else:
        ans += p
        A[i+1] = 0
print(ans)
# Judge status: Accepted
k, a, b = list(map(int, input().split()))

l = k - (a - 1)
ab = a + (b - a) * (l // 2) + (l % 2) 

print(max(1+k, ab))
# Judge status: Wrong Answer
s=input()
print(["vowel","consonant"][s=="a" or s=="i" or s=="u" or s=="e" or s=="o"])
# Judge status: Accepted
#ABC-109-B
N = int(input())
ans = "Yes"
memo = {}
word = input()
memo[word] = None
last_char = word[-1]

for _ in range(N-1):
    word = input()
    if word in memo:
        ans = "No"
        break
    if word[0] != last_char:
        ans = "No"
        break
    memo[word] = None
    last_char = word[-1]

print(ans)
# Judge status: Accepted
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7



def main():
  s = input()
  dic = {}
  i = 0
  while i != len(s):
    if not s[i] in dic.keys():
      dic[s[i]] = 1
    else:
      print('no')
      exit()
    i +=1
  print('yes')
  
if __name__ == '__main__':
  main()
# Judge status: Accepted
w,h,x,y=map(int,input().split())
op=0
if w/2==x and h/2==y:
    op=1
print(w*h/2,op)
# Judge status: Accepted
X = int(input())

ans = 0
yokin = 100

while True:
    yokin = int(yokin * 1.01)
    ans += 1
    if yokin >= X:
        break
        
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

from fractions import gcd

def make_divisors(n: int):
    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

divisors = make_divisors(M)

ans = 0
for i in range(len(divisors)):
    d = divisors[i]
    if d*(N-1) >= M:
        continue
    ans = max(ans, gcd(d, M-(d*(N-1))))

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

A, B, C, D = map(int, input().split(' '))
min_bd = min(B, D)
max_ac = max(A, C)
diff = min_bd - max_ac
ans = 0
if diff > 0:
    ans = abs(diff)
print(ans)
# Judge status: Wrong Answer
s = input()
a = int(s[:2])
b = int(s[2:])

if (1 <= a <= 12) and (1 <= b <= 12):
  print("AMBIGUOUS")
elif (1 <= a <= 12):
  print("YYMM")
elif (1 <= b <= 12):
    print("MMYY")
else:
  print("NA")
# Judge status: Accepted
q,h,s,d = map(int, input().split())
n = int(input())

two = min(8*q, 4*h, 2*s, d)
one = min(4*q, 2*h, s)
x = n // 2 * two
x += (n % 2) * one
print(x)
# Judge status: Accepted
import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)] #1_indexed
for i,j in itertools.product(range(1,N+1),range(W+1)):
    w,v = wv[i-1]
    if j-w>=0:
        dp[i][j] = max(dp[i][j],dp[i-1][j-w]+v)
    dp[i][j] = max(dp[i][j],dp[i-1][j])
print(dp[-1][-1])
# Judge status: Accepted
H = int(input())
k = H
p = 1
s = 0
while k >1:
     k = k // 2
     p += 1
for i in range (p):
    s += 2**i
print(s)
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, n + 1):
    ans += i * (((n // i) * ((n // i) + 1)) // 2)
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
li = [[0,0] for _ in range(n)]
t1,t2 = 0,0
for i in range(m):
    a,b = input().split()
    if li[int(a)-1][0] != 1:
        if b == "WA":
            li[int(a)-1][1] += 1
        if b == "AC":
            li[int(a)-1][0] += 1
for i in range(n):
    t1 += li[i][0]
    t2 += li[i][1]*li[i][0]
print(t1,t2)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if (abs(b-a)<=d and abs(c-b)<=d) or abs(a-c) <=d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import factorial

n, m = map(int, readline().split())
mod = 10 ** 9 + 7
ans = factorial(n) * factorial(m)
if abs(n - m) > 1:
    ans = 0
elif n == m:
    ans *= 2
print(ans % mod)
# Judge status: Accepted
r,g,b = map(int,input().split())
n = 100*r + 10*g + b
if n % 4 == 0 :
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
import time


pretime = time.time()
print(pretime)
pretime = pretime
a = [x for x in range(10 ** 7)]
print(a[-5])
thistime = time.time()
print(thistime - pretime)
pretime = thistime
b = []
for x in range(10 ** 7): b.append(x)
print(b[-5])
thistime = time.time()
print(thistime - pretime)
pretime = thistime
c = [0] *(10 ** 7)
for x in range(10 ** 7): c[x] = x
print(c[-5])
thistime = time.time()
print(thistime - pretime)
pretime = thistime
d = list(range(0, 10 ** 7))
print(d[-5])
thistime = time.time()
print(thistime - pretime)
pretime = thistime
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

a,b,c=MI()
if (a+b+c)%2==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
i = 1
a,b = map(int, input().split())
m = 0
while m <= a:
    m += i
    i += 1

diff = abs(m - a)
print(diff)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

A,B,C = map(int, input().split())

print(C, A, B)
# Judge status: Wrong Answer
r,g,b = map(int,input().split())
if g*10+b %4==0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
[A,V]=[int(i) for i in input().split()]
[B,W]=[int(i) for i in input().split()]
T=int(input())
if abs(A-B)>T*abs(V-W):print("NO")
else:print("YES")
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = 1
b = 2
for i in range(1,m+1):
  print(a,b)
  a = a + 1
  b = b + i
# Judge status: Accepted
N = int(input())
ans = (10**N + 8**N - 2*(9**N)) % (10**9 + 7)
print(ans)
# Judge status: Accepted
from collections import Counter
n=int(input())
s=input()
S=Counter(s)

ans=1
for i in S.values():
    ans *=i+1
print((ans-1)%(10**9+7))
# Judge status: Accepted
import sys

def solve():
      input = sys.stdin.readline
      N = int(input())
      count = N - 1
      for i in range(2, N):
            b = 1
            while i * b < N:
                  count += 1
                  b += 1
      print(count)

      return 0

if __name__ == "__main__":
      solve()
# Judge status: Accepted
score_dic = {}

for i in range(int(input())):
    s = input()
    if s not in score_dic:
        score_dic[s] = 1
    else:
        score_dic[s] += 1

for i in range(int(input())):
    t = input()
    if t not in score_dic:
        score_dic[t] = -1
    else:
        score_dic[t] -= 1

max_value = max(score_dic.values())
if max_value < 0:
    print(0)
else:
    print(max_value)
# Judge status: Wrong Answer
K,X=map(int,input().split())
if 500*K>X:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A, B = map(int, input().split())
if A < 9 and B < 9:
    print(A * B)
else:
    print(-1)
# Judge status: Accepted
a = int(input())

if 400 <= a and a <= 599:
    print(8)
elif 600 <= a and a <= 799:
    print(7)
elif 800 <= a and a <= 999:
    print(6)
elif 1000 <= a and a <= 1199:
    print(5)
elif 1200 <= a and a <= 1399:
    print(4)
elif 1400 <= a and a <= 1599:
    print(3)
elif 1600 <= a and a <= 1799:
    print(2)
elif 1800 <= a and a <= 1999:
    print(1)