peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
N,X = map(int,input().split())
array = list(map(int,input().split()))

count = 1
point = 0
for I in range(len(array)):
    point += array[I]
    if point <= X:
        count += 1
    else:
        break
print(count)
# Judge status: Accepted
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

s = input()
t = input()[::-1]

if s == t:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
p=[a[0]]
for i in range(1,n):
  p.append(p[-1] ^ a[i])
  
S=p[-1]
b=[v^S for v in a]
print(*b,sep=' ')
# Judge status: Wrong Answer
N,K = map(int, input().split())
H = list(map(int, input().split()))

dp_list = [10**4+1]*len(H)
dp_list[0]=0

## DP
for h in range(1,len(H)): ## 各位置ごとに計算していく
  loop_cnt = min(K,h) ## 前の石にどれくらい戻れるか、の計算
  cost = dp_list[h]
  for m in range(1,loop_cnt+1):
    cost_tmp = abs(H[h]-H[h-m])+dp_list[h-m]
    cost = min(cost,cost_tmp)
  dp_list[h] = cost

ans = dp_list[-1]
print(ans)
# Judge status: Wrong Answer
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    S, W = iim()
    print("safe" if S >2*W else "unsafe")

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N and n > 1:
  e = 1
  while n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n % p == 0:
      n //= p
    p += 2 - (p == 2)
else:
  score += n > 1
print(score)
# Judge status: Accepted
s,t=input().split()
a,b=input().split()
aa=int(a)
bb=int(b)
u=input()
if u==s:
    aa=aa-1
elif u==t:
    bb=bb-1
print(aa,"",bb)
# Judge status: Wrong Answer
import collections
import heapq
n = int(raw_input())
ais = [0] + map(int, raw_input().split(' ')) 
res = [0] * (n +1)
for u in range(n, 0, -1):
	c = u *2
	cumul = 0
	while(c <= n):
		cumul += res[c]
		c += u


	if ais[u] == 1:
		if cumul % 2 == 0: res[u] = 1
	elif ais[u] == 0:
		if cumul % 2 == 1: res[u] = 1
cc = collections.Counter(res)
print cc[1]
print ''.join([str(i) for i in range(len(res)) if res[i]])
# Judge status: Accepted
from collections import deque
from bisect import bisect_left

n = int(input())
l = sorted(map(int, input().split()))
ld = deque(l)
cnt = 0
for a in range(n - 2):
    l_a = ld.popleft()
    for b in range(a + 1, n - 1):
        cnt += bisect_left(l, l_a + l[b]) - b - 1
print(cnt)
# Judge status: Accepted
N = int(input())
flag = 0
ans = "No"
for i in range(N):
  A,B = input().split()
  if A == B:    
    flag += 1
  else:
    flag = 0
  if flag == 3:
    ans = "Yes"
    break
    
print(ans)
# Judge status: Wrong Answer
def main():
    n = int(input())

    count = 0
    answer = 'No'
    for i in range(n):
        d = list(map(int, input().split()))
        if d[0] == d[1]:
            count += 1
        if count >= 3:
            answer = 'Yes'

    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1,n+1):
  ans += (n//i)*(n//i+1)//2*i
print(ans)
# Judge status: Accepted

N = int(input())

current = (0, 0, 0)
for i in range(N):
  ct, cx, cy = map(int, current)
  t, x, y = map(int, input().split())

  v = abs(x-cx) + abs(y-cy)
  if abs(t-ct) < v:
    print("No")
    exit()

  if abs(t-ct) % 2 != v % 2:
    print("No")
    exit()

print("Yes")
# Judge status: Wrong Answer
def LI():return list(map(int,input().split()))

# toriaezudasudakedasu

n,m=LI()

for i in range(1,m+1):
    a=i
    b=(a+m+(i-1))
    while b>n:
        b-=m
    print(a,b)
# Judge status: Accepted
S = input()
s = set(S)
if "7" in s:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a  = list(map(int, input().split()))
b = abs(a[0] - a[1])
 
if b % 2 == 0:
  print(max(a[0], a[1]) - b // 2)
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
X, A, B = map(int, input().split())

if B - A <= 0:
    print('delicious')
elif B - A <= X:
    print('safe')
else:
    print('dangerous')
# Judge status: Wrong Answer
price = int(input())
amari = price % 1000
print(amari)
# Judge status: Accepted
if '7' in input():
	print("Yes")
else:
	print("No")
# Judge status: Accepted
N ,M = map(int,input().split())
L = []
ans = 0
for i in range(1,int(M**(1/2)+1)):
    if M % i == 0:
        if i >= N: ans = max(ans,M//i)
        if M // i >= N: ans = max(ans,i)
print(ans)
# Judge status: Accepted
a=int(input())
if a>=30:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n=int(input())
print((n/3)*(n/3)*(n/3))
# Judge status: Accepted
import bisect as bis
n, m = map(int, input().split())
p, y = [], []
idx = lambda x: x-1
for _ in range(m):
    p_, y_ = map(int, input().split())
    p.append(p_)
    y.append(y_)
val = [[] for _ in range(n)]
for i in range(m):
    val[idx(p[i])].append(y[i])
for i in range(n):
    val[i].sort()
for i in range(m):
    v = p[i]
    id = bis.bisect_right(val[idx(v)], y[i])
    print(str(v).zfill(6) + str(id).zfill(6))
# Judge status: Wrong Answer
N, M, K = map(int, input().split())
pa = abs(N-M) + 1
A = list(map(int, input().split()))+ [1000000010]
B = list(map(int, input().split()))+ [1000000010]
if N < M:
    A = A + [1000000010]*(pa)
elif N > M:
    B = B + [1000000010]*(pa)
c = 0
while K >= A[0] or K >= B[0]:
    if A[0] < B[0]:
        K -= A.pop(0)
    else:
        K -= B.pop(0)
    c += 1
print(c)
# Judge status: Accepted
s = list(input())

s = set(s)

if len(s) % 2 == 0 and (("S" in s and "N" in s) or ("E" in s and "W" in s)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
*X,=map(int,input().split())

ans=10**9
i=1
while i<=100:
    j=0
    count=0
    while j<N:
        count+=(i-X[j])**2
        j+=1
    ans=min(ans,count)
    i+=1

print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
if b <= 0 and d <= 0:
    print(c * a)

elif b > 0 and d > 0:
    print(b * d)

elif b < 0 and d > 0:
    if c > 0:
        print(c * a)
    else:
        print(b * c)

elif b > 0 and d < 0:
    if a > 0:
        print(a * c)
    else:
        print(a * d)
# Judge status: Accepted
import sys

def input():
    return sys.stdin.readline().rstrip('\n')


DAYS = {
    'SUN':7,
    'MON':6,
    'TUE':5,
    'WED':4,
    'THU':3,
    'FRI':2,
    'SAT':1,
}

S = input()
#A,B = list(map(int,input().split()))

print(DAYS[S])
# Judge status: Accepted
n = int(input())
s = input()

x = 0
res = 0
for op in list(s):
    if op=="I":
        x += 1
    else:
        x -= 1
    res = max(res, x)
print(res)
# Judge status: Accepted
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
s=input()

cnt=Counter(s)
ans=1
for i in al:
    ans*=cnt[i]+1
    ans%=mod
ans-=1
print(ans%mod)
# Judge status: Accepted
l = float(input())

x = l/3

print(x**3)
# Judge status: Accepted
from math import gcd
N = int(input())
A = list(map(int,input().split()))
ans = A[0]

for e in A:
    ans = gcd(e,ans)
print(ans)
# Judge status: Accepted
import sys

n = int(input())
s = [int(i)%4 for i in sys.stdin.read().split()]
s0 = s.count(0)
s2 = s.count(2)
if n - s0 - s2 <= s0 + (s2 == 0):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def solve():
    n, k = map(int, input().split())
    if n % k == 0:
        print(0)
    else:
        print(1)


if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
import math
a,b = input().split()
s =int(a+b)

if float(int(math.sqrt(s))) == int(math.sqrt(s)):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
ps = list(map(int, input().split()))

print(sum(ps) - max(ps))
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input().strip())
m = max(a, b, c)
tmp = m
for i in range(k):
    m *= 2
print(sum((m, a, b, c)) - tmp)
# Judge status: Accepted
N = int(input())
d = list(map(int,input().split()))
sd = sorted(d)
#Kとしてあり得る値は sd[N // 2 - 1] + 1 から d[N // 2] までの合計 d[N // 2] - d[N // 2 - 1] 個
print(sd[N//2]-sd[N//2-1])
# Judge status: Accepted
N,Q=map(int,input().split())
S=input()
l=0
r=0
l=[0]*Q
r=[0]*Q
s=[]
s.append(0)

for i in range(1,N):
    if(S[i-1]=='A' and S[i]=='C'):

        s.append(s[i-1]+1)

    else:
        s.append(s[i-1])

for i in range(Q):

    l[i],r[i]=map(int,input().split())
for i in range(Q):
    print(s[r[i]-1]-s[l[i]-1])
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())
for i in range(k):
    if a > b:
        b *= 2
    elif b > c:
        c *= 2
print('Yes') if a < b < c else print('No')
# Judge status: Accepted
import heapq
from collections import defaultdict
N,M = map(int,input().split())
AB = defaultdict(list)
for i in range(N):
    a,b = list(map(int,input().split()))
    if a not in AB:
        AB[a] = [-b]
    else:
        AB[a] += [-b]
work = 0
AB2 = []
heapq.heapify(AB2)
for i in range(1,M+1):
    for j in AB[i]:
        heapq.heappush(AB2,j)
    if not AB2:
        continue
    b = heapq.heappop(AB2)
    work += -b
print(work)
# Judge status: Wrong Answer
from sys import stdin
import math

n, k = [int(x) for x in stdin.readline().rstrip().split()]

cnt = 1
if n <= k:
    print(cnt)
    exit

kk = k
while n >= kk:
    kk = kk * k
    cnt += 1


print(cnt)
# Judge status: Accepted
def main():
    Q, H, S, D = (int(i) for i in input().split())
    N = int(input())
    one = min(4*Q, 2*H, S)
    two = min(2*one, D)
    ans = 0
    if N & 1:
        ans += one
        N -= 1
    ans += two * (N // 2)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
for i in range(1, N):
    eat = max(a[i - 1] + a[i] - x, 0)
    cnt += eat
    a[i] -= eat
print(cnt)
# Judge status: Wrong Answer
import math
import time
from collections import deque
from copy import deepcopy

t = time.time()
def iip():
    ret = [int(i) for i in input().split()]
    if len(ret) == 1:
        return ret[0]
    return ret


def main():
    n = iip()


    if n == 0:
        print(0)
        exit()
    if n % 2 == 1:
        print(0)
        exit()

    ret = 0
    n = n / 2
    for i in range(1, 1145141919810):
        ret += int(n/(5**i))
        if 5**i > n:
            break


    print(ret)


main()
# Judge status: Accepted
a=list(map(int,input().split()))
if a[1]//a[0]<a[2]:
    print(a[1]//a[0])
else:print(a[2])
# Judge status: Accepted
a = [int(input())for i in range(5)]
k = int(input())
print( "Yay!" if max(a)-min(a) <= k else ":(" )
# Judge status: Accepted
n=int(input())
s=list(input())
ans=[]
for i in range(len(s)):
  a=int(((ord(s[i])+n)%65)%26)
  ans.append(chr(a+65))

print(''.join(ans))
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]
maxA = max(A)
copy_A = A[:]
copy_A.remove(maxA)
secondA = max(copy_A)
for x in A:
    if x == maxA:
        print(secondA)
    else:
        print(maxA)
# Judge status: Wrong Answer
import math
import itertools

N, K = map(int, input().strip().split())
L = math.pow(10, 10)

values = [0] * (N + 1)
for i in range(N + 1):
    values[i] = i

amount = 0
for comb_no in range(K, N + 2):
    possible_values = set()
    for combination in itertools.combinations(values, comb_no):
        possible_values.add(sum(combination))
    print(len(possible_values))
# Judge status: Accepted
def main():
    n = int(input())
    c = input()
    r = 0
    for i in range(n):
        if c[i]=='R':
            r += 1
    ans = 0
    for i in range(r):
        if c[i]=='W':
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n, r = map(int, input().split())
print( r+100*max(0, 10-n) )
# Judge status: Accepted
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
input_str = input()
next_idx = ascii_lowercase.index(input_str)+1
print(ascii_lowercase[next_idx])
# Judge status: Wrong Answer
N = int(input())
dp = [[0]*10 for _ in range(10)]

for i in range(1, N+1):
  if i%10==0: continue
  strI = str(i)
  if len(strI) > 1:
    f,l = strI[-1], strI[0]
    dp[int(f)][int(l)] += 1
  else:
    dp[i][i] += 1

res = 0
for i in range(1,10):
  for j in range(1,10):
    if i==j or dp[i][j]>1:
      res += dp[i][j] * dp[j][i]

print(res)
# Judge status: Wrong Answer
n = int(input())
A=list(map(int, input().split()))

ans="No"
c2=c4=0
for a in A:
    if a%4==0:
        c4+=1
    elif a%2==0:
        c2+=1

if c2==1:
    c2=0

if (n-c2)//2<=c4 :
    ans="Yes"
else:
    ans="No"

print( ans )
# Judge status: Accepted
s = input()
ans = 1000
for i in range(len(s) - 2):
  t = int(s[i: i + 3])
  ans = min(abs(753 - t), ans)
print(ans)
# Judge status: Accepted
a,b=map(int, input().split())
if (a+b)%2==1:
    print('IMPOSSIBLE')
else:
    print((a+b)//2)
# Judge status: Wrong Answer
a = input().split()
b = input().split()
b.sort()
sum = 0

for i in range(int(a[1])):
    sum += int(b[i])

print(sum)
# Judge status: Wrong Answer
N = int(input())
A = sorted(list(map(int, input().split())))

B =list(set(A))

print('YES' if A == B else 'NO')
# Judge status: Wrong Answer
N = int(input())
tmp = []
if(N == 0):
  print('0')
else:
  N = N // 2
  while(abs(N)>1):
    tmp.append(N%2)
    N = N // 2
  tmp.append(1)
tmp.reverse()
print(''.join([str(n) for n in tmp]))
# Judge status: Wrong Answer
N=int(input())
print((N**3)//27)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 1

judge = 0
for i in range(n-1):
  if a[i] == a[i+1]:
    break
  elif a[i] < a[i+1]:
    if judge == -1:
      ans += 1
    else:
      judge = 1
  elif a[i] > a[i+1]:
    if judge == 1:
      ans += 1
    else:
      judge = 1      
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
nlist = list(map(int,input().split()))
ans = 0
for i in range(n):
  if nlist[i] >= sum(nlist)/(4*m):
    ans += 1
if ans >= m:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
num = list(map(int, input().split()))
if num[1] != 0:
    arr = list(map(int, input().split()))
    arr.sort()
    l_num = arr[0]
    l_diff = 10000
    for i in range(arr[0]-1, arr[-1]+2):
        if abs(num[0]-i) < l_diff and i not in arr:
            #print(i, num[0], l_num, abs(i-num[0]))
            l_num = i
            l_diff = abs(num[0]-i)
    print(l_num)
else:
    print(num[0])
# Judge status: Wrong Answer
tmp = list(map(int, input().split()))
x = tmp[0]
n = tmp[1]
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

i = 1

while True:
    if not x-i in p:
        print(x-i)
        break
    if not x+i in p:
        print(x+i)
        break
    i += 1
# Judge status: Accepted
a,b,c=sorted(list(map(int,input().split())))
if a*b*c%2==0:print(0)
else:print(a*b)
# Judge status: Accepted
a, b, c = map(int, input().split())
l = 4 * a * b
r = (c - a - b) ** 2

if c - a - b < 0 or l >= r:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
alist = []

for i in range(1, n+1):
    alist.append(a.index(i)+1)

print(alist)
# Judge status: Accepted
s = list(input())
# s = list(str(10**200000))
n = len(s)
ans = 0
s.reverse()
# print(s)
x = 1
tot = 0
count = [0]*2019
for i in range(n):
    count[tot]+=1
    tot += int(s[i])*x
    # print(tot)
    tot %= 2019
    ans += count[tot]
    x = x*10%2019
print(ans)
# Judge status: Accepted
n = int(input())
min = 100
a_sum = 0
b_sum = 0

for a in range(1, n):
  b = n-a
  while a >= 1:
    a_sum += a%10
    a = a//10
  
  while b >= 1:
    b_sum += b%10
    b = b//10
  
  if a_sum + b_sum < min:
    min = a_sum + b_sum
  
  a_sum = 0
  b_sum = 0

print(min)
# Judge status: Accepted
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
b=[list(map(int,input().split())) for i in range(m)]
b.sort(key=lambda x:x[1])
p=0
c=[]
for i in b[::-1]:
  if p>n:
    break
  c+=[i[1]]*i[0]
  p+=i[0]
n=min(len(c),n)
c=c[:n]
m=sum(a)
x=m
for i in range(n):
  m=m-a[i]+c[i]
  x=max(x,m)
print(x)
# Judge status: Accepted
n, m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split())) for i in range(m)]
bc = sorted(bc, key = lambda x : x[1], reverse=True)

sum_b = 0
for b, c in bc:
    sum_b += b
    a += [c] * b
    if n < sum_b:
        break
a.sort(reverse=True)
a = a[:n]

print(sum(a))
# Judge status: Accepted
N,M=map(int,input().split())
lmax,rmin=1,N
for i in range(M):
  l,r=map(int,input().split())
  if l > lmax:lmax=l
  if r < rmin:rmin=r
print(max(rmin-lmax+1,0))
# Judge status: Accepted
import itertools

N,M,Q = map(int,input().split())
li = []

for i in range(Q):
  li.append(list(map(int,input().split())))
li.sort(key = lambda x:x[3])
num = [i for i in range(1,M+1)] 
l = list(itertools.combinations_with_replacement(num, N))
max_sum=-1
for i in range(len(l)):
  s = 0
  for j in range(Q):
    if l[i][li[j][1]-1] -  l[i][li[j][0]-1] == li[j][2]:
      s+= li[j][3]
      
  max_sum = max(max_sum,s)
print(max_sum)
# Judge status: Wrong Answer
s = input()
if s[0] != s[1] != s[2]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input()) ; n+=1
A=list(map(int,input().split()))
if n==1:
    if A[0]==1: print(1);exit()
    print(-1);exit()
if A[0]!=0:print(-1);exit()
ANS=[0]*n ;ANS[0]=1
R=[0]*n
for i in range(n-2,-1,-1):
    R[i]=R[i+1]+A[i+1]
#print(R)
for i in range(1,n):
    ANS[i]=min(ANS[i-1]*2-A[i], R[i])
    if ANS[i]<0:print(-1);exit()
print(sum(A)+sum(ANS))
# Judge status: Wrong Answer
import math

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

sum = 0

for skill in array:
  a -= skill
if(a <= 0):
  print("yes")
else:
  print("no")
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))

A = sorted(a, reverse=True)
B = []
ans = 0
B = A[:2*N]
for i in range(int(len(B)/2)):
    ans += B[2*i+1]

print(ans)
# Judge status: Accepted
n, y = map(int, input().split())
for i in range(n + 1):
	for j in range(n+1 - i):
		k = n - i - j
		if i *10000 + j * 5000 + k *1000 == y:
			print(i,j,k)
			exit()
			
print('-1 -1 -1')
# Judge status: Accepted
s = input()
num = 1000

for i in range(len(s)-2):
    num = min(num, abs(753-int(s[i:i+3])))

print(num)
# Judge status: Accepted
n,m=map(int,input().split())
if n<m/2:print(n+(m-n*2)//4)
else:print(m//2)
# Judge status: Accepted
a = int(input())
ans = 1
for i in range(1,a+1):
  ans = (ans*i)%1000000007
print(ans)
# Judge status: Accepted


N = int(input())
ans = 0
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)
# Judge status: Wrong Answer
A, B, K = map(int,input().split())
a = 0
b = 0

if K <= A:
  a = A - K
elif A < K <= A + B:
  a = 0
  b = B + A - K

print(str(a) + ' ' + str(b))
# Judge status: Accepted
k,n = (int(x) for x in input().split())
list = [int(i) for i in input().split()]
list.append(k+list[0])
long = 0
for i in range(n):
    long = max(long,list[i+1]-list[i])

print(k-long)
# Judge status: Wrong Answer
N=int(input())
ans=0
if N%2==0:
    for i in range(1,19):
        ans+=N//(10**i)
print(ans)
# Judge status: Accepted
A,B=map(int,input().split())
print('Yay!' if A<=8 and B<=8 else ':(')
# Judge status: Accepted
A = list(map(int, input().split()))
N = int(input())

A[0]*=4
A[1]*=2
t1=10**10
for i in range(3):
   t1=min(t1,A[i])

A[0]*=2
A[1]*=2
A[2]*=2
t2=10**10
for i in range(4):
   t2=min(t2,A[i])

if(N%2==1):
    print(t2*(N//2)+t1)
else:
    print(t2*(N//2))
# Judge status: Wrong Answer
N,M = map(int,input().split())
P = []
S = []
total = []


for i in range(M):
    a,b = map(str,input().split())
    P.append(a)
    S.append(b)
ok = 0
pena = 0

for (i,j) in zip(P,S):
    if not i in total:
        if j=='WA':
            pena+=1
        elif j=='AC':
            ok+=1
            total.append(i)
print(str(ok)+' '+str(pena))
# Judge status: Accepted
L = int(input())
print(pow(L / 3, 3))
# Judge status: Accepted
mod = 10**9+7
n, a, b = map(int, input().split())
ans = pow(2, n, mod) - 1
nCa = 1
for i in range(n-a+1, n+1):
    nCa *= i
    nCa %= mod
for i in range(1, a+1):
    nCa *= pow(i, mod-2, mod)
    nCa %= mod
nCb = 1
for i in range(n-b+1, n+1):
    nCb *= i
    nCb %= mod
for i in range(1, b+1):
    nCb *= pow(i, mod-2, mod)
    nCb %= mod
ans -= (nCa + nCb)
ans %= mod
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)
    exit()
print(A*B*C//max(A,B,C))
# Judge status: Accepted
dic_s = {x:input() for x in 'abc'}

dic_i = {x:i for x,i in zip('abc',[0,0,0])}
dic_max = {x:len(dic_s[x]) for x in 'abc'}
nt = 'a'
while True:  
  if dic_max[nt] == dic_i[nt]:
    break
  else:
    dic_i[nt] += 1
    nt = dic_s[nt][dic_i[nt]-1]    
print(nt.upper())
# Judge status: Accepted
N=int(input())
ans=''

if N==0:
    print('0')
    exit()

while N!=0:
    Nmod=N%(-2)
    ans+=str(abs(Nmod))
    
    if Nmod==-1:
        N=N//(-2)+1
    else:
        N=N//(-2)

print(''.join(list(reversed(ans))))
# Judge status: Accepted
s=input()
s_length=len(s)
target=753
ans=753
for i in range(s_length-2):
    comp=int(s[i:i+3])
    ans=min(abs(target-comp),ans)
print(ans)
# Judge status: Accepted
abcd = input()
for i in range(2**3):
    eq = ''
    for j in range(3):
        eq += abcd[j]
        if(i >> j) & 1:
            eq += '+'
        else:
            eq += '-'
    eq += abcd[-1]
    if eval(eq) == 7:
        print(eq + '=7')
        break
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10**7) 
x,y=map(int,input().split())
sum=0
def chess(i,j):
  a=0
  if i == x and j == y:
    a+=1
    return a
  elif i>x or j>y:
    return 0
  elif i<x and j<y:
    return chess(i+1,j+2)+chess(i+2,j+1)
  return a
  
print(chess(0,0)//10**9+7)
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a <= 5:
    print(0)
elif 6 <= a <= 12:
    print(b/2)
else:
    print(b)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
pre = -2
for i in A:
  ans += B[i-1]
  if pre + 1 == i:
    ans += C[i-2]
  pre = i
print(ans)
# Judge status: Wrong Answer
n,k,q = map(int,input().split())
a = [int(input()) for A in range(q)]
ans = [k]*(n+1)
for i in range(1,q):
	ans[a[i-1]] += 1
for j in range(1,n+1):
	ans[j] -= q
ans.pop(0)
for h in range(n):
	print("Yes" if ans[h] > 0 else "No")
# Judge status: Accepted
s = input()

if 'A' in s and 'B' in s:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

if n % 2 == 1:
    info = sorted(info)
    l = info[n // 2][0]
    info = sorted(info)[::-1]
    r = info[n // 2][1]
    print(r - l + 1)

else:
    info = sorted(info)
    l, lmax = info[n // 2 - 1]
    del info[n // 2 - 1]
    info = sorted(info)[::-1]
    rmin, r = info[n // 2 - 1]
    print((lmax - l + 1) + (r - rmin + 1) - 1)
# Judge status: Wrong Answer
s = raw_input()

month = int(s[5:7])
if month > 5:
    print "TBD"
else:
    print "Heisei"
# Judge status: Accepted
n=int(input())
mb=[int(input()) for i in range(5)]
print(-(-n//min(mb))+4)
# Judge status: Accepted
h, n = map(int, input().split())
a = list(map(int, input().split()))
sum_a = sum(a)
if sum_a >= h:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import itertools
n = int(input())
l = list(map(int, input().split()))
ans = 0
for a,b,c in itertools.combinations(l,3):
    if abs(a-b) < c < a+b and len(set([a,b,c])) == 3:
        ans += 1
print(ans)
# Judge status: Accepted
a = list(map(int,input().split()))
a.sort()
if a[0]==5 and a[1]==5 and a[2]==7:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
b -= a
if b <= 0:
    print('delicious')
    
else:
    if b > x:
        print('gangerous')
    else:
        print('safe')
# Judge status: Accepted
k = int(input())
now = 7
for i in range(1, k+1):
    if int(now) % k == 0:
        print(i)
        break
    now = 10 * now + 7
    now %= k
else:
    print(-1)