peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n, _ = map(int, input().split())
nums = list(map(int, input().split()))
total = sum(nums)
ans = total - n
print(ans)
# Judge status: Wrong Answer
import sys
import numpy as np

sys.setrecursionlimit(10 ** 9)

N, W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]

wv.sort()

ans = 0
dp = np.zeros(W, dtype=int)

for w, v in wv:
    np.maximum(dp[:-w] + v, dp[w:], out = dp[w:])

ans = dp[-1]
print(ans)
# Judge status: Accepted
x = int(input())
ans = x//11 * 2
if 1<= x%11 <= 6: ans += 1
elif 7 <= x%11 <= 10: ans += 2
print(ans)
# Judge status: Accepted
h,w=map(int,input().split())
if (h==1 and w!=1) or (h!=1 and w==1):
    print(1)
else:
    m=h*w
    print((m+2-1)//2)
# Judge status: Wrong Answer
from fractions import gcd
a, b = map(int, input().split())

print(a*b / gcd(a, b))
# Judge status: Accepted
n = int(input())
total = n
for i in range(n):
    total += i

print(total)
# Judge status: Wrong Answer
K = int(input())
L = []
for i in range(1,K+1):
    t =input()
    L.append(t)
print(len(L))
# Judge status: Accepted
N=int(input())
ans=float("inf")
for i in range(1,N):
   a,b=map(int,list(str(i))),map(int,list(str(N-i)))
   ans=min(ans,sum(a)+sum(b))
print(ans)
# Judge status: Accepted
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
num=0
dist=abs(a-(t-h[0]*0.006))
for i in range(1,n):
    if dist>abs(a-(t-h[i]*0.006)):
        num=i
        dist=abs(a-(t-h[i]*0.006))
print(num+1)
# Judge status: Wrong Answer
N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
T = {S[0]:1}
for j in range(1,N):
    if S[j] not in T:
        T[S[j]] = 1
    else:
        T[S[j]] += 1
T_sorted = sorted(T.items(),key = lambda x:-x[1])
maxT = T_sorted[0][1]
for k in range(len(T_sorted)):
    if T_sorted[k][1] != maxT:
        break
    print(T_sorted[k][0])
# Judge status: Accepted
#coding:utf-8
x = int(input())
ans = (x // 11) * 2
x = x % 11
if (x==0):
    pass
elif (x <= 6):
    ans += 1
else:
    ans += 2
print (ans)
# Judge status: Accepted
d = int(input())
print("Christmas", end = " ")
if d == 24: print("Eve")
elif d == 23: print("Eve Eve")
elif d == 22: print("Eve Eve Eve")
# Judge status: Accepted

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
p=p[:x]
q=q[:y]
p[x:x]=q
p[x+y:x+y]=r
p.sort(reverse=True)
p=p[:x+y]
print(sum(p))
# Judge status: Accepted
n = int(input())
b = list(map(int, input().split()))

ans = b[0] + b[-1]
for i in range(n-2):
   ans += min(b[i], b[i+1])

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

def main():
    N = int(input())
    nl = [[0 for _ in range(10)] for _ in range(10)]
    
    for i in range(1,N+1):
        s = str(i)
        if s[-1] != "0":
            nl[int(s[0])][int(s[-1])] += 1

    ans = 0
    for i in range(10):
        for j in range(10):
            ans += nl[i][j]*nl[j][i]
            
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a, b, c = map( int, input().split())

if a == b+c or a + b == c or a + c == b:
  print('Yes')
else:
  'No'
# Judge status: Accepted
k,n=map(int,input().split())
a=[int(i) for i in input().split()]

saitanhiku=a[2]-a[1]
for i in range(n-1):
    if a[i+1]-a[i]>=saitanhiku:
        saitanhiku=a[i+1]-a[i]
if (k-a[n-1])+a[0]>=saitanhiku:
    saitanhiku=k-a[n-1]+a[0]
print(k-saitanhiku)
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(int, input().split()))

ans = 1
tmp = k

while True:
  if tmp >= n:
    break
    
  tmp += k - 1
  ans += 1
  
print(ans)
# Judge status: Accepted
import math

a,b=map(int,input().split())
s=input()

t=s.partition("-")


if s[a]=='-' and t[0].isnumeric() and t[2].isnumeric():
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math

n = int(input())
mov = []
for i in range(5):
    mov.append(int(input()))

print(math.ceil(n/min(mov))+4)
# Judge status: Wrong Answer
import math
a = 0.0
b = 0.0
a,b = map(float,input().split())
print(
math.floor(a*b)
)
# Judge status: Wrong Answer
import math

x, y = [int(x) for x in input().split()]
print(1 + math.floor(math.log2(y / x)))
# Judge status: Accepted
from math import sqrt

N=int(input())
XY=[]
for i in range(N):
    x,y=map(int,input().split())
    XY.append([x,y])

distance=0
for i in range(N):
    for j in range(i+1,N):
        distance+=sqrt( pow( (XY[i][0])-(XY[j][0]) ,2 ) + pow(XY[i][1] - XY[j][1],2) )

tmp=0        
for i in range(1,N):
    tmp+=i
    

print(distance*(N-1)/tmp)
# Judge status: Accepted
import numpy as np
bingo = np.ndarray((3,3)).astype(np.int)
for i in range(3):
    line = list(map(int,input().split()))
    bingo[i] = line
N = int(input())

for _ in range(N):
    b = int(input())
    bingo[bingo==b] = 0

row = min(np.max(bingo,axis=1))
col = min(np.max(bingo,axis=0))
diag = min(bingo[0,0]+bingo[1,1]+bingo[2,2],bingo[0,-1]+bingo[1,-2]+bingo[2,-3])
if min(row,col,diag)==0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, k = map(int,input().split())
h = list(map(int,input().split()))
h.sort()
h.reverse()
if (k > n):
    k = n
for i in range(k):
    h[i] = 0
print(sum(h))
# Judge status: Accepted
n = int(input())
a = []
for i in range(n):
    l,m = map(int,input().split())
    a.append([l,m])
f = 0
for i in range(n-2):
    if a[i][0] == a[i][1] and a[i+1][0] == a[i+1][1] and a[i+2][0] == a[i+2][1]:
        f = 1
if f == 0:
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
def main():
    K,A,B = map(int,input().split())
    if B-A<=2:
        pass
    else:
        print(1+K)
        exit()
    now = 1
    K -= (A-1)
    now = A
    if K%2==0:
        now += (B-A)*(K//2)
    else:
        now += (B-A)*((K-1)//2)
        now += 1
    print(now)  
if __name__ == '__main__':
    main()
# Judge status: Accepted
X,A,B=map(int,input().split())

if A>=B:
  print("delicious")
elif B-A<=X:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
import collections

n = int(input())
A = list(map(int, input().split()))
q = int(input())

CNT = collections.Counter(A)
ANS = []
ans = sum(A)

for i in range(q):
    b, c = map(int, input().split())
    t = CNT[b]
    ans +=(c - b) * t
    ANS.append(ans)
    CNT[c] += t
    CNT[b] = 0

for i in ANS:
    print(i)
# Judge status: Wrong Answer
n=int(input())
c=[1]
i=1
while (6**i<=100000):
  c.append(6**i)
  i+=1
i=1
while (9**i<100000):
  c.append(9**i)
  i+=1
c.sort()
m=[1]
for i in range(1,n):
  mi=1000000
  for j in range(len(c)):
    if i-c[j]<0:
      break
    if m[i-c[j]]+1<mi:
      mi=m[i-c[j]]+1
  m.append(mi)
print(m[n-1])
# Judge status: Accepted
S=input()
ans=10**3
for i in range(len(S)-2):
  x=int(S[i])*100+int(S[i+1])*10+int(S[i+2])
  ans=min(abs(x-753),ans)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, Y = map(int, input().split())
Y //= 1000
for i in range(N + 1):
  x = Y - 10 * i
  for j in range(N - i + 1):
    y = x - 5 * j
    if y < 0: continue
    if i + j + y == N:
      print(i, j, y)
      exit(0)
  if x + i == N:
    print(i, 0, x)
    exit(0)
print(-1, -1, -1)
# Judge status: Accepted
N = int(input())
A = int(input())
while N >= 500:
  N -= 500
if N <= A:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer


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

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)

    divisors.sort()
    return set(divisors)
    
ans=make_divisors(A) & make_divisors(B)
ans=list(ans)[::-1]
print(ans[C-1])
# Judge status: Accepted
s = str(input())
n = len(s)
D = [0]*3
for i in range(n):
    D[ord(s[i])-ord('a')] += 1
#print(D)

D.sort(reverse=True)

if D[0]-1 <= D[1] <= D[0] and D[2] >= D[0]-1:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
A, B, K = map(int, input().split())

for i in range(A, min(A + K, B + 1)):
    print(i)
for i in range(max(B - K + 1, A + K), B + 1):
    print(i)
# Judge status: Accepted
from collections import defaultdict
(n, m), *q = [[*map(int, i.split())] for i in open(0)]
d = defaultdict(list)
for k, v in q:
    d[k].append(v)
c = defaultdict(dict)
for k, v in d.items():
    for i, j in enumerate(sorted(v)):
        c[k][j] = i + 1
for p, y in q:
    print("{:0>6}{:0>6}".format(p, c[p][y]))
# Judge status: Accepted
def main():
	a,b , c = map(int , input().split())
	ans = a*b*c
	ans = min(ans, abs(b*c*((a//2)-(a-(a//2)))))
	ans = min(ans, abs(a*c*((b//2)-(b-(b//2)))))
	ans = min(ans, abs(b*a*((c//2)-(c-(c//2)))))
	print(ans)
if __name__=="__main__":
	main()
# Judge status: Accepted
s = int(input())
MOD = 10**9 + 7
dp = [0] * (s+10)
dp[0] = 1

for i in range(3, s+10):
    dp[i] = sum(dp[:i-2])
    dp[i] %= MOD

print(dp[s]%MOD)
# Judge status: Accepted
from sys import stdin

def main():
    n = int(input())
    nn = n ** 2
    nnn = n ** 3
    ans = n + nn + nnn
    print(ans)
    

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
work = [0]*n

for i in range(n):
  a, b = map(int, input().split())
  work[i] = (b, a)

work.sort(reverse=True)

ans = 0
key = 0
for i in range(m):
  while key < n-1 and work[key][1] + i > m:
    key += 1
    if key == n-1:
      break
  if key == n-1:
    if work[key][1] + i <= m:
      ans += work[key][0]
    break
  ans += work[key][0]
  key += 1

print(ans)
# Judge status: Accepted
def resolve():
    A, B, C, K = list(map(int, input().split()))
    MX = 10 ** 18
    if K % 2 == 0:
        print(A-B)
        return
    else:
        print(B-A)
    return

resolve()
# Judge status: Accepted
from sys import stdin
input = stdin.buffer.readline

n, t = map(int, input().split())

cost = 10000

for _ in range(n):
    c, i = map(int, input().split())
    if i <= t and c < cost:
        cost = c

if cost == 10000:
    print('TLE')
else:
    print(cost)
# Judge status: Accepted
N, L = map(int, input().split())

S = []

for _ in range(N):
    s = input()
    S.append(s)

S.sort()

for obj in S:
    print(obj, end="")

print()
# Judge status: Wrong Answer
n, a, b = list(map(int, input().split()))
print((b - a) * (n - 2) + 1)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())

ab = a - b
bc = b - c
ac = a - c

if ab <= d and bc <= d or ac <= d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

a.sort()
k = a[n-1]
r = a[0]
dis = abs(a[n-1]/2-a[0])
for i in range(n-1):
    if dis > abs(a[n-1]/2-a[i]):
        dis = abs(a[n-1]/2-a[i])
        r = a[i]
print(k,r)
# Judge status: Accepted
from fractions import gcd

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

a = A[0]
for i in range(N):
    a = gcd(a, A[i])

print(a)
# Judge status: Wrong Answer
n = list(input())
n = [int(i) for i in n]
n.reverse()
l = len(n)
ans = 0
for i in range(l-1):
    if (n[i]==5 and n[i+1]>=5) or n[i]>5:
        n[i+1] += 1
        ans += 10-n[i]
    else:
        ans += n[i]
ans += 9-n[-1] if n[-1]>5 else n[-1]
print(ans)
# Judge status: Wrong Answer
import sys
a,b,c = map(int,input().split(" "))
li = [[a,b,c]]
count = 0
for i in range(100):
  a2 = a/2
  b2 = b/2
  c2 = c/2
  a = b2+c2
  b = c2+a2
  c = a2+b2  
  count += 1
  if (a % 2)==1 or (b % 2)==1 or (c % 2)==1:
    break
  elif [a,b,c] in li:
    print(-1)
    sys.exit()
  else:
    li.append([a,b,c])
    
print(count)
# Judge status: Accepted
N = int(input())

for i in range(1, 10):
  for j in range(1, 10):
    if i * j == N:
      print('Yes')
      exit()
print('No')
# Judge status: Accepted
X = input()
N = len(X)

ans = 10000
for i in range(N-3+1):
    ans = min(ans, abs(int(X[i:i+3])-753))

print(ans)
# Judge status: Wrong Answer
K,N=map(int, input().split())
A=list(map(int, input().split()))
dist=[]
for i in range(len(A)):
    if i==0:
        dist.append(K-A[len(A)-1]+A[i])
        dist.append(A[i+1]-A[i])

    elif i<len(A)-1:
        dist.append(K-A[i+1]-A[i])
        dist.append(A[i+1]-A[i])

target=max(dist)
print(K-target)
# Judge status: Accepted
N,A,B = map(int, input().split())
adds = A + B
times = N // adds
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)
# Judge status: Wrong Answer
n = int(input())
x = []
for i in range(n):
    tmpx, tmpl = map(int,input().split())
    x.append((tmpx,tmpl))
x = sorted(x)
#print(x)
ans = n

flag = 1
for i in range(n-1):
    if x[i][0]+x[i][1]>x[i+1][0] and flag == 1:
        ans -= 1
        flag = 0
    elif x[i][0]+x[i][1]<=x[i+1][0] and flag == 0:
        flag = 1
print(ans)
# Judge status: Accepted
a,b,t = map(int,input().split())
x = t//a
print(b*x)
# Judge status: Accepted
eng="abcdefghijklmnopqrstuvwxyz"
c=input()

for i in range(25):
    if c==eng[i]:
        ans=eng[i+1]
        break

print(ans)
# Judge status: Wrong Answer
W,H,N = map(int, input().split())
l = 0
r = W
row = 0
up = H
for i in range(N):
    x,y,a = map(int, input().split())
    if a == 1:
        l = x
    elif a == 2:
        r = x
    elif a == 3:
        row = y
    else:
        up = y
print(max((r-l)*(up-row),0))
# Judge status: Accepted
N = int(input())
T = [int(input()) for i in range(N)]
import math
a = T[0]
for i in range(1,N):
    a = (a*T[i]) // math.gcd(a,T[i])
print(a)
# Judge status: Accepted
N, Y = map(int, input().split())

answer = '-1 -1 -1'
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = str(x) + ' ' + str(y) + ' ' + str(z) 
            break
print(answer)
# Judge status: Accepted
import math
a, b, n = map(int, input().split())

if n < b:
    ans = math.floor(a * n / b)
else:
    ans = math.floor(a * (b - 1) / b)

print(ans)
# Judge status: Wrong Answer
a, b =map(int, input().split())
print('Yey!' if a<=8 and b <= 8 else ':(')
# Judge status: Wrong Answer
def main():
    mod = 1000000007
    N, M, *A = map(int, open(0).read().split())
    F = [0] * (N + 1)
    F[0] = 1
    if 1 in A:
        F[1] = 1
    for i in range(2, N + 1):
        if i not in A:
            F[i] = (F[i-1] + F[i-2]) % mod
    print(F[N])


if __name__ == "__main__":
    main()
# Judge status: Accepted
N, Y = map(int, input().split())

match = False
for a in range(N+1):
    for b in range(N+1):
        c = N - (a + b)
        y = 10000*a + 5000*b + 1000*c
        if c >= 0 and y == Y:
            match = True
            break
    if match:
        break

if match:
    print(a, b, c)
else:
    print(-1, -1, -1)
# Judge status: Accepted
n,k=map(int,input().split())
p=[int(i)+1 for i in input().split()]

num=sum(p[:k])
tot=[num]
t_append=tot.append
for i in range(n-k):
  tmp=p[i+k]-p[i]
  num+=tmp
  t_append(num)
#print(tot)
print(max(tot)/2)
# Judge status: Accepted
N, K, S = map(int, input().split())

if S == 10**9:
    ans = [S for _ in range(K)] + [1] * (N - K)
else:
    ans = [S for _ in range(K)] + [S + 1] * (N - K)

print(' '.join(map(str, ans)))
# Judge status: Wrong Answer
s = input()
n = len(s)

for i in range(n-1):
  if s[i] == "A":
    break
    
for j in range(n-1)[::-1]:
  if s[j] == "Z":
    break
    
print(len(s[i:j+1]))
# Judge status: Accepted
N = int(input())
A, B, C = [], [], []
for n in range(N):
    a, b, c = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)
a, b, c = 0, 0, 0
for n in range(N):
    a, b, c = A[n] + max(b, c), B[n] + max(c, a), C[n] + max(a, b)
print(max(a, b, c))
# Judge status: Accepted
x=input()
y=input()
if x[0]==y[2] and x[1]==y[1] and x[2]==y[0]:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
def main():
    N, M = map(int, input().split(" "))
    ac = 0
    wa = 0
    accpted = []
    for _ in range(M):
        ps = input().split(" ")
        if ps[0] not in accpted:
            if ps[1] == "AC":
                ac += 1
                accpted.append(ps[0])
            else:
                wa += 1
    print(ac, wa)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>b or (a==1 and b==13):
    print("Alice")
elif a==b:
    print("Draw")
    
else:
    print("Bob")
# Judge status: Wrong Answer
n, k = map(int, input().split())
A = list(map(int, input().split()))
order = [-1] * (n+1)
v = [0] * (n+1)
v[0] = 1
order[v[0]] = 0
# iは順番
for i in range(1, n+1):
    v[i] = A[v[i-1] - 1]
    if order[v[i]] != -1:
        old_i = order[v[i]]
        c = i - old_i
        break
    order[v[i]] = i
if k < old_i:
    print(v[k-1])
else:
    print(v[(k - old_i)%c + old_i])
# Judge status: Accepted
from collections import deque

N = int(input())

CSFs = [list(map(int, input().split())) for _ in range(N-1)]

h = deque([0])

for i in range(N-2,-1,-1):
  t = CSFs[i][1]
  t += CSFs[i][0]
  for j in range(i+1,N-1):
    if t < CSFs[j][1]:
      t = CSFs[j][1]
    else:
      if t%CSFs[j][2] > 0:
        t += CSFs[j][2] - (t%CSFs[j][2])
    t += CSFs[j][0]
  h.appendleft(t)
  
while h:
  print(h.popleft())
# Judge status: Wrong Answer
o = [input()]
e = [input()] + [""]
for x, y in zip(o, e): print(x+y, end="")
# Judge status: Accepted
a,b,c = map(int,input().split())
ans = 0
for i in range(1,b+1):
    if (a*i)%b == c:
        ans = 1
        break
print(["NO","YES"][ans])
# Judge status: Wrong Answer
import sys
readline = sys.stdin.readline

def gcd(a,b):
    if a < b:
        a,b = b,a
    while a % b != 0:
        r = a % b
        a,b = b,r
    return b

def solve():
    X = int(readline())
    a = 180 - X

    g = gcd(a, 360)
    ans = 360 // g
    print(ans)


solve()
# Judge status: Wrong Answer
N = int(input())
ans = 0


for i in range(1,10):
  if 111*i<=N<(111*i+1):
    ans += 111*i
  else:
    pass
  
print(ans)
# Judge status: Wrong Answer
import math
a, b, n = map(int, input().split())
if b>n:
    print(math.floor(a*n/b))
else:
    y = a-1 if a>b else b-1
    x = y if y>n else n
    print(math.floor(a*x/b)-a*math.floor(x/b))
# Judge status: Wrong Answer
n = int(input())
s = [input() for _ in range(n)]
l = []
for i in s[0]:
    #print(i)
    if all(i in s[j] for j in range(n)):
        l.append(i)
    #print(l)
    
print("".join(sorted(l)))
# Judge status: Wrong Answer
import math
N, x = map(int, input().split())
L = [int(x) for x in input().split()]
ans = 0
for i in L[1:N-1]:
    ans += i
m = math.floor((N-1)/2)
if L[0] > x:
    ans += L[0] - x
if L[N-1] > x:
    ans += L[N-1] - x
ans -= m * x
if ans < 0:
    ans = 0
print(ans)
# Judge status: Accepted
a, b, x = map(int, input().split())
if a == 0:
    print(b//x+1)
else:
    print(b//x-(a-1)//x)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))

ans = [0]*8
free = 0
for a in A:
    for i in range(8):
        if a < (i+1)*400:
            ans[i]=1
            break
    if 3200 <= a:
        free += 1
ans_max = min(8, sum(ans)+free)
ans_min = sum(ans)
print(ans_min, ans_max, sep=' ')
# Judge status: Accepted
s = input()
l = len(s)
t = input()
ans = 'No'
for i in range(l):
    s = s[-1]+s[:l-1]
    if s==t:
        ans = 'Yes'
        break
print(ans)
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
print('Yes' if abs(a-b)<=d or abs(a-c)<=d and abs(c-b)<=d else 'No')
# Judge status: Accepted
S = input()
K = int(input())
z = ord('z') + 1

res = ""
flg = False
for i,c in enumerate(S):
    if c == 'a':
        res += 'a'
        continue
    elif z - ord(c) <= K:
        res += 'a'
        K -= z-ord(c)
    else:
        res += chr(ord(c))

res = res[:-1] + chr((ord(res[-1])-ord('a') + K) % 26 + ord('a'))
print(res)
# Judge status: Accepted
S = input()
S2 =list(S)
for i in range(3):
    if S2[i] ==S2[i+1]:
        print("Bad")
        break
else:
    print("Good")
# Judge status: Accepted
n, a, b = map(int, input().split())
mod = 10**9 + 7

c_table = [n] * max(a, b)

for i in range(1, len(c_table)):
    numer = n - i
    denom = i + 1
    c_table[i] = c_table[i-1] * numer * pow(denom, mod-2, mod) % mod

ans = pow(2, n, mod) - 1 - c_table[a-1] - c_table[b-1]
print(ans % mod)
# Judge status: Accepted
n = int(input())
an = list(map(int,input().split()))

mod = 10**9 + 7
total =sum(an)
ans = 0
z = an[0]

for x in range(n-1):
  nokori = total-z
  ans += an[x] * nokori % mod
  z += an[x+1]

    
ans = ans % mod    
print(ans)
# Judge status: Wrong Answer
S = input()
T = input()
ans = len(T)
for start in range(len(S) - len(T)):
  dif = 0
  for i in range(len(T)):
    if T[i] == S[start + i]:
      dif += 1
  ans = min(ans, dif) 
print(ans)
# Judge status: Wrong Answer
A = list(input())
if A[1]=='B' :
  print('先週開催されたコンテストはABCなので、今週はARCが開催されます。')
else:
  print('先週開催されたコンテストはARCなので、今週はABCが開催されます。')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
m = 1000
temp = 0
for i in range(n-1):
    if a[i+1] < a[i]:
        m+=temp*a[i]
        temp = 0
    else:
        temp += m//a[i]
        m%=a[i]
m+=temp*a[-1]
print(m)
# Judge status: Accepted
n,m = map(int,input().split())
m_2 = m//2
ans = min(n,m_2)

if ans < m_2:
    make_s = m - ans*2
    ans += make_s // 4
    
print(ans)
# Judge status: Accepted
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]

mx = 0
for ss in s:
	mx = max(s.count(ss) - t.count(ss),mx)

print(mx)
# Judge status: Wrong Answer
n = int(input())

isp = []
for i in range(1, n+1):
    s, p = input().split()
    isp.append([i, s, int(p)])
    
isp = sorted(isp, key=lambda x: x[2])
isp = sorted(isp, key=lambda x: x[1], reverse=True)
for i in isp:
    print(i[0])
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
mode = [0]*(10**5+2)
for i in range(len(a)):
    k = a[i]
    if(a == 0):
        mode[k] += 1
        mode[k+1] += 1
    else:
        mode[k-1] += 1
        mode[k]   += 1
        mode[k+1] += 1

print(max(mode))
# Judge status: Accepted
#175 A
S = input()
if S == 'RRR':
    print(3)
elif S == 'SRR' or S == 'RRS':
    print(2)
elif S == 'SSS':
    print(0)
else:
    print(1)
# Judge status: Accepted
a,b = map(int, input().split())
print((a+b+1)//2)
# Judge status: Accepted
d = int(input())
c = list(map(int, input().split()))
prev = [0] * 26
for i in range(d):
  s = list(map(int, input().split()))
  happy = - (10 ** 10)
  ans = -1
  # 各問題を出題した場合に得られる幸福度の最大値を計算
  for j in range(26):
    tmp = s[j] # j を出題した際に得られる幸福度
    if tmp > happy:
      happy = tmp
      ans = j
  prev[ans] = i
  print(ans+1)
# Judge status: Accepted
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n, l = LI()
s = SR(n)
s.sort()
print(''.join(s))
# Judge status: Wrong Answer
N = int(input())

n_hoge = int(N ** 0.5)
print

true_ans = 10 ** 12
for i in range(1,n_hoge):
    if N % i == 0:
        ans = N // i
        true_ans = min(ans + i - 2, true_ans)

print(true_ans)
# Judge status: Accepted
from collections import Counter

n=int(input())
s=[]
for i in range(n):
  a=input()
  s.append(a)
c=Counter(s)

mx=max(c.values())
ans=[]
for i in c:
  if c[i]==mx:
    ans.append(i)
ans.sort()
for i in ans:
  print(i)
# Judge status: Accepted
n = int(input())
count = 0
for i in range(16):
  if count:
    break
  if n - i * 7 == 0:
    print('Yes')
    count = 1
    break
  for j in range(26):
    if n - i * 7 - j * 4 == 0:
      print('Yes')
      count = 1
      break
if not(count):
  print('No')