peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a, b, c, d = (int(i) for i in input())
op = ["+", "-"]
for op_1 in op:
    ans_1 = eval("{}{}{}".format(a, op_1, b))
    for op_2 in op:
        ans_2 = eval("{}{}{}".format(ans_1, op_2, c))
        for op_3 in op:
            if eval("{}{}{}".format(ans_2, op_3, d)) == 7:
                print("{}{}{}{}{}{}{}=7".format(a, op_1, b, op_2, c, op_3, d))
                exit()
# Judge status: Accepted
n=int(input())
a = list(map(int, input().split()))
for i in a:
    if i%2==0 and i%3 and i%5:
        print('DENIED')
        exit()
else:
    print('APPROVED')
# Judge status: Accepted
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

A = inpl()
A.sort()
if A[0]!=A[2]:
    if A[0]==A[1]:
        print('Yes')
        sys.exit()
    if A[1]==A[2]:
        print('Yes')
        sys.exit()
print('No')


# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)
# Judge status: Wrong Answer
l=[list(map(int,input().split())) for i in range(3)]

sum_l=0
ans="No"

for i in l:
  sum_l+=sum(i)
  
if sum_l%3==0:
  ans="Yes"

print(ans)
# Judge status: Wrong Answer
from collections import Counter

N = int(input())
s = list(input())
c = Counter(s)

for _ in range(N - 1):
    s = list(input())
    tmp = Counter(s)
    for k, v in c.items():
        if k not in tmp:
            c[k] = 0
        else:
            c[k] = min(c[k], v)

ans = ""
c = sorted(c.items(), key=lambda x: x[0])
for k, v in c:
    ans += k * v
print(ans)
# Judge status: Accepted
s = input()
if (1 <= int(s[0:2]) and int(s[0:2]) <= 12) and (1 <= int(s[2:4]) and int(s[2:4]) <= 12):
    ans = "AMBIGUOUS"
elif (1 <= int(s[0:2]) and int(s[0:2]) <= 12) and (1 > int(s[2:4]) or int(s[2:4]) > 12):
    ans = "MMYY"
elif (1 > int(s[0:2]) or int(s[0:2]) > 12) and (1 <= int(s[2:4]) and int(s[2:4]) <= 12):
    ans = "YYMM"
else:
    ans = "NA"
print (ans)
# Judge status: Accepted
x, k, d = list(map(int, input().split()))
x = abs(x)

if k * d <= x:
    print(x - k * d)
else:
    k -= x//d
    x %= d
    if k % 2 == 0:
        print(x)
    else:
        print(abs(x-d))
# Judge status: Wrong Answer
N=int(input())
a=1
cnt=1
while cnt<=N:
  a+=1
  cnt+=a
A=[]
S=N
for i in range(a):
  if S==3:
    A.append(2)
    A.append(1)
    break
  if S>=(a-i):
    A.append(a-i)
    S-=(a-i)
for i in (A[::-1]):
  print(i)
# Judge status: Accepted
X = int(input())
answer = (X // 500) * 1000
X %= 500
answer += (X // 5) * 5
print(answer)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

C = [0] * N 
C[0] = A[0] + sum(B)
for i in range(1,N):
    C[i] = C[i-1]+A[i]-B[i-1]
print(max(C))
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
def lcm(a, b):
    return a // gcd(a, b) * b

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

L = lcm(C, D)

def f(X):
    return X - (X//C + X//D - X//L)

num = f(B) - f(A-1)

print(num)
# Judge status: Accepted
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    a=list(map(int,readline().split()))

    li=[0]*(10**5+2)
    for i in range(n):
        li[a[i]]+=1

    cnt=0
    for x in range(1,10**5+1):
        cnt=max(cnt,li[x-1]+li[x]+li[x+1])

    print(cnt)

if __name__=="__main__":
    main()
# Judge status: Accepted
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    score=i
    cnt=0
    while(K>score):
        score=score*2
        cnt+=1
    ans+=(1/N)*(0.5**cnt)
print("{:.12f}".format(ans))
# Judge status: Accepted
s_list = list(map(str, input().rstrip()))

ans = []

for s in s_list:
    if s=="0":
        ans.append("0")
    elif s=="1":
        ans.append("1")
    elif s=="B":
        if len(ans)==0:
            continue
        else:
            ans.pop()

print("".join(ans))
# Judge status: Accepted
def main():
    def reviewSum(n):
      sum = 0
      while n > 0:
          sum += n % 10
          n = n // 10
      return sum
    
    N, A, B = map(int, input().split())
    total = 0
    for i in range(N + 1):
        sum = reviewSum(i)
        if sum >= A and sum <= B:
          total += i
    print(total)
main()
# Judge status: Accepted
n,k,*l=map(int,open(0).read().split())
for _ in range(k):
  s=[0]*(n+1)
  for i in range(n):
    s[max(i-l[i],0)]+=1
    s[min(i+l[i]+1,n)]-=1
  s[0]=min(s[0],n)
  for i in range(1,n):
    s[i]=min(s[i-1]+s[i],n)
  s.pop()
  if s==l: break
  l=s
print(*l)
# Judge status: Accepted
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 divisors

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

ans = 1

div = make_divisors(m)

for i in div:
    if i * n <= m:
        ans = i
    else:
        break

print(ans)
# Judge status: Accepted
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
MOD = 10**9 + 7

def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(k, n + 2):
        ans += i * (n - i + 1) + 1
    print(ans%MOD)


if __name__ == '__main__':
    main()
# Judge status: Accepted
# A - Wanna go back home
def can_go_home(dir1, dir2):
	if dir1 > 0 and dir2 > 0:
		return True
	elif dir1 == 0 and dir2 == 0:
		return True
	else:
		return False


n, w, s, e = 0, 0, 0, 0

for dir in input():
	if dir == 'N':
		n += 1
	elif dir == 'W':
		w += 1
	elif dir == 'S':
		s += 1
	else:
		e += 1

if can_go_home(n, s) and can_go_home(e, w):
	print('Yes')
else:
	print('No')
# Judge status: Accepted
import math

r = int(input())

R = 2*r*math.pi

print(R)
# Judge status: Accepted
A,B,M = [int(i) for i in input().split(' ')]
a = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]

dis = [[int(i) for i in input().split(' ')] for j in range(M)]

ls = [min(a)+min(b)]

for d in dis:
  ans = a[d[0]-1] + b[d[1]-1] - d[2]
  ls.append(ans)
  
print(min(ls))
# Judge status: Accepted
N, K = [int(x) for x in input().split()]
dest = [int(x) for x in input().split()]
route = [1]
flag = [1] + [0] * (N-1)
t = 1
while True:
  if flag[dest[t-1]-1] == 0:
    t = dest[t-1]
    route.append(t)
    flag[t-1] = 1
  else:
    loop = route.index(dest[t-1])
    L_loop = len(route) - loop
    break
  #print(route)
  #print(flag)
ans = 0
if K < len(route):
  ans = route[K]
else:
  K = K - len(route)
  ans = route[loop + (K % L_loop)]
print(ans)
# Judge status: Wrong Answer
input()
ans = 1
for i in map(int, input().split()):
  ans *= i
  if ans > 10**8:
    print(-1)
    exit()

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
H = []
for _ in range(N):
    H.append(int(input()))
H = list(sorted(H))
r_min = 10 ** 10
for i in range(N-K+1):
    n_min = H[i]
    n_max = H[i+K-1]
    r_min = min(r_min, n_max-n_min)
print(r_min)
# Judge status: Wrong Answer
H = int(input())
W = int(input())
N = int(input())

print(N // max(H, W))
# Judge status: Wrong Answer
S = input()
N = int(len(S))
A = "Yes"
n = N//2
m = n//2

for i in range(n):
  if S[i] != S[N-1-i]:
    A = "No"
    break
for i in range(m):
  if S[i] != S[m-1-i] or S[n+1+i] != S[N-1-i]:
    A = "No"
    break
print(A)
# Judge status: Wrong Answer
S = str(input())
N = len(S)


def solve(S):
    # S: 文字列
    r = N % 2
    for i in range((N+1)//2):
        s = S[:N-(2*i+r)]
        n = len(s)
        if s[:(n//2)] == s[(n//2):]:
            ans = N - (2 * i + r)
    return ans


print(solve(S))
# Judge status: Wrong Answer
n,k=map(int,input().split())
h=[]
for i in range(n):
    h.append(int(input()))
h_sort=sorted(h)
print(min(h[j+k-1]-h[j] for j in range(n-k+1)))
# Judge status: Accepted
N,A,B = (int(x) for x in input().split())
if (B - A) % 2 == 0:
    print((B-A)//2)
else:
    if B - A == 1:
        if A == 1 or B == N:
            print('1')
        else:
            print('2')
    else:
        if A <= N-B:
            print((A+B-1)//2)
        else:
            print((2*N-A-B+1)//2)
# Judge status: Accepted
n = input()
print('Yes' if n[0] == n[1] == n[2] or n[1] == n[2] == n[3] else 'No')
# Judge status: Wrong Answer
N, Y = [int(i) for i in input().split()]

ans = []
for i in range(N+1):
    for j in range(N+1):
        if 10000*i + 5000*j + 1000*(N-i-j) == Y:
            ans.append([i, j, N-i-j])

if len(ans) == 0:
    print(-1 -1 -1)
else:
    print(ans[0][0], ans[0][1], ans[0][2])
# Judge status: Accepted
def odd(num):
	return num//2+num%2

N=int(input())

num = odd(N)/N
print("{:.10f}".format(num))
# Judge status: Wrong Answer
n, k, s = list(map(int, input().split()))
if n == k:
  print(s, " ", end="")
  for i in range(n - 1):
    print(0, " ", end="")
else:
  j = k + 1
  l = n - j
  for i in range(int(j/2)):
    print(1, " ", end="")
    print(s - 1, " ", end="")
    j -= 2
  if j == 1:
    print(1, " ", end="")
  for i in range(l):
    print(s-2, " ", end="")
# Judge status: Wrong Answer
a=str(input())
if '7' in a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
tmp = []
#b- (a-1)

for i in range(1, n+1):
    tmp.append(a[i-1] - i)
tmp.sort()
#print(tmp)
b = tmp[n//2]
ans = 0
for i in range(1, n+1):
    ans += abs(a[i-1] - (b+i))
print(ans)
# Judge status: Wrong Answer
import numpy as np

N = int(input())
M, *A = sorted(map(int, input().split()), reverse=True)
if N == 2:
    print(M, *A)
    quit()

A = np.abs(np.array(A, dtype=np.int64) - M / 2)
A.sort()
print(M, int(A[0] + M / 2))
# Judge status: Accepted
a,b,k=map(int,input().split())
c,d=set(range(a,a+k)),set(range(b-k+1,b+1))
if b-a>=k:
  e=c|d
else:
  e=c&d
for i in sorted(e):
  print(i)
# Judge status: Accepted
S=input()
N=len(S)
st=[]

for str in S:
  #print(st,str)
  if len(st)==0:
    st.append(str)
  else:
    if str!=st[-1]:
      st.pop()
    else:
      st.append(str)
      
print(N-len(st))
# Judge status: Accepted
n = int(input())

s = ['' for i in range(n)]
def dfs(k, c):
    if k == n:
        print("".join(s))
        return
    for i in range(c):
        s[k] = chr(i+ord('a'))
        dfs(k+1, c)
    s[k] = chr(c+ord('a'))
    dfs(k+1, c+1)

dfs(0, 0)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
# 標準入力の取得
N, M = list(map(int, input().split()))

# 求解処理
result = max((N - 2) * (M - 2), 0)

# 結果出力
print(result)
# Judge status: Wrong Answer
s = list(input())
t = list(input())

if sorted(s) == sorted(t):
    print('Yes')

else:
    print('No')
# Judge status: Wrong Answer
x = list(map(int,input().split()))

n = x[0]
a = x[1]
b = x[2]

s = input()
c = 0
k = 0

for i in range(0,n):
  if(s[i] == "c"):
    print("No")
    continue
  elif(s[i] == "a"):
    if(c < a + b):
      print("yes")
      c = c + 1
    else:
      print("No")
  else:
    if(c < a + b and k < b):
      print("Yes")
      c = c + 1
      k = k + 1
    else:
      print("No")
# Judge status: Accepted
import itertools

N,K=map(int,input().split())
d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
A=list(itertools.chain.from_iterable(A))

count=0
for i in range(1,N+1):
    if not i in A:count+=1
print(count)
# Judge status: Accepted
X,A,B=map(int,input().split())

if (A-B)>=0:
  print('delicious')
elif (A-B)<0 and (X-B+A)>=0:
  print('safe')
else:
  print('dangerous')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))


left = a[0]
right = sum(a[1:])
ans = abs(left - right)
for i in range(1, n-1):
    left += a[i]
    right -= a[i]
    ans = min(ans, abs(left-right))
print(ans)
# Judge status: Accepted
n, a, b = map(int,input().split())
s = input()
c = 0
d = 0
for i in range(len(s)):
    if s[i] == "a" and c < a+b:
        print("Yes")
        c += 1
    elif s[i] == "b" and d < b and c < a+b:
        print("Yes")
        d += 1
        c += 1
    else:
        print("No")
# Judge status: Wrong Answer
K, S = map(int, input().split())
count = 0
for x in range(1,K+1):
  for y in range(1,K+1):
    for z in range(1,K+1):
      if x + y + z == S:
        count = count + 1
print(count)
# Judge status: Wrong Answer
N,M=map(int,input().split())
LR=[]
for i in range(M):
  LR.append(list(map(int,input().split())))
l,r=LR[0][0],LR[0][1]
for i in range(M):
  if LR[i][0]<l and LR[i][1]<r:
    r=LR[i][1]
  elif l<LR[i][0] and LR[i][1]<r:
    l,r=LR[i][0],LR[i][1]
  elif l<LR[i][0] and r<LR[i][1]:
    l=LR[i][0]
print(r-l+1)
# Judge status: Accepted
N=int(input())
B=[int(x)for x in input().split()]
A=[B[0]]
for i in range(1,N-1):
    A.append(min(B[i-1],B[i]))
A.append(B[-1])
print(sum(A))
# Judge status: Accepted
l,r,d=map(int,input().split())
ans=0
for i in range(l,r+1):
    if i%d==0:
        ans+=1
print(ans)
# Judge status: Accepted
K,X=map(int,input().split())
print(*[x for x in range(X-K+1,X+K)])
# Judge status: Accepted
s = set(input())
letters = set("abcdefghijklmnopqrstuvwxyz")
ans = sorted(letters ^ s)
print(ans[0] if len(ans) != 0 else "None")
# Judge status: Wrong Answer
from numpy import prod

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

first_term = prod(a[:k])
for i in range(n - k):
    term = first_term / a[i]
    term = term * a[k+i]
    if int(term) > int(first_term):
        print('Yes')
    else:
        print('No')
    first_term = int(term)
# Judge status: Accepted
import math


def main():
    k = int(input())

    GCD = [[0] * 201 for i in range(201)]
    for ki1 in range(1, k + 1):
        for ki2 in range(1, k + 1):
            GCD[ki1][ki2] = math.gcd(ki1, ki2)

    ans = 0
    for ki1 in range(1, k + 1):
        for ki2 in range(1, k + 1):
            for ki3 in range(1, k + 1):
                ans += GCD[GCD[ki1][ki2]][ki3]

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer


a = int(input("\n"))

if a >= 10:
    print("Number too big")

elif a < 1:
    print("Number too small")
    
else:
    print(int(a + (a**2) + (a**3)))
# Judge status: Accepted
n,m = map(int,input().split())
A = [0] + list(map(int,input().split()))
B = [ [] for _ in range(n + 1) ]
for _ in range(m):
    s,e = map(int,input().split())
    B[s].append(A[e])
    B[e].append(A[s])
ans = 0
for i in range(1,n+1):
    if len(B[i]) == 0:
        ans += 1
    elif max(B[i]) < A[i]:
        ans += 1
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

print('Yes' if A < C < B or B < C < A else 'No')
# Judge status: Accepted
S = input()

st = 0
en = 0

for i in range(len(S)):
    if S[i] == "A":
        st = i
        break

for i in range(len(S)):
    if S[i] == "Z":
        en = i

print(en - st + 1)
# Judge status: Wrong Answer
N,S = map(int,input().split())
n,s = map(int,input().split())
T = int(input())

dis = n - N
speed = S - s

if n < N:
  print("NO")
elif dis <= speed*T:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N,A,B = map(int,input().split())
print(max(0,(N-1)*B+A-(N-1)*A-B+1))
# Judge status: Accepted
a, b = map(int, input().split())

if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
from collections import deque
S = input()
L = len(S)
d = deque()
for i in range(L):
    if S[i] == "0":
        d.append("0")
    elif S[i] == "1":
        d.append("1")
    else:
        if len(d) != 0:
            d.pop()

ans = ''.join(d)
print(ans)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(len(L) - 1):
    if L[i] - L[i + 1] >= 0:
        ans = ans + L[i] - L[i + 1]
        L[i + 1] = L[i]

print(ans)
# Judge status: Wrong Answer
N, M = map(int,input().split())

half = N//2
for i in range(M):
    print(half-i,half+i+1)
# Judge status: Accepted
import math
N = int(input())
print(min([a + N // a - 2 for a in range(math.floor(math.sqrt(N)) + 1, 0, -1) if N % a == 0]))
# Judge status: Wrong Answer
N=int(input())
if N%2==0:
    print(N/2)
else:
    print((N-1)/2+1)
# Judge status: Wrong Answer
input();l=list(input().split());print(*l[-1::-2]+l[::2])
# Judge status: Accepted
#coding:utf-8
#カツサンドくん

n, m = map(int, input().split())
#各食べ物ごとの解答集計用
count = [0] * m

for i in range(n):
    enq = list(map(int, input().split()))
    for j in range(1, len(enq)):
        food = enq[j] - 1
        count[food] += 1

ans = 0
for item in count:
    if item == n:
        ans += 1

print(ans)
# Judge status: Wrong Answer
from math import gcd
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt_a, cnt_b = 0, 0
for i in range(n):
    if a[i] < b[i]:
        cnt_b += b[i] - a[i]
    elif a[i] > b[i]:
        cnt_a += a[i] - b[i]

print("Yes" if cnt_b % 2 == 0 and cnt_a <= cnt_b else "No")
# Judge status: Wrong Answer
[A, B, M] = input().split()
A = int(A)
B = int(B)
M = int(M)

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

cut_map = [[0*i for i in range(B)] for j in range(A)]
for i in range(M):
    [inx, iny, inc] = list(map(int, input().split()))
    if cut_map[inx-1][iny-1] > -inc:
        cut_map[inx-1][iny-1] = -inc

for i in range(A):
    for j in range(B):
        cut_map[i][j] = a[i] + b[j]

print(min(min(cut_map)))
# Judge status: Wrong Answer
N, M = map(int, input().split())
print( N * (N-1) / 2 + M * (M-1) / 2 )
# Judge status: Wrong Answer
print(["EOvdedn"][eval(input().replace(" ","*"))%2::2])
# Judge status: Wrong Answer
H, W = (int(x) for x in input().split())

if H * W == 1:
    k = 1
elif H*W % 2 == 1:
    if (H == 1 or W == 1) and H*W != 1:
        a = list(filter(lambda x: x != 1, [H, W]))
        k = int(a[0] / 2) + 1
    else:
        k = int(H / 2) + (int(W / 2)) * H + 1
elif H * W % 2 == 0:
    k = int(H * W / 2)

print(k)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
c = [0]*(n-1)
s = [0]*(n-1)
f = [0]*(n-1)

for i in range(n-1):
    c[i], s[i], f[i] = map(int, input().split())

def dfs(eki,t):
    if eki == n-1:
        return t

    cc = c[eki]
    ss = s[eki]
    ff = f[eki]

    t = max(ss,t)

    return dfs(eki+1, -(-t)//ff*ff+cc)

for i in range(n):
    print(dfs(i,0))
# Judge status: Accepted
X = int(input())
import math
ans = 360 // math.gcd(360, X)
print(ans)
# Judge status: Accepted
s = int(input())
y3 = (s+10**9-1)//10**9
x3 = 10**9*y3-s
print(0,0,10**9,1,x3,y3)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _  in range(n)]


d = {}
for i in a:
    if i not in d:
        d[i] =0
        d[i] +=1
    elif i in d:
        d[i] -=1
l =[]
for i in d.keys():
    if d[i] != 0:
        l.append(d[i])
print(len(l))
# Judge status: Accepted
import math

h, w = list(map(int, input().split()))

if h == 1 or w == 1:
	print(1)
else:
	print(math.ceil((h * w) / 2))
# Judge status: Wrong Answer
A,B,C = map(int,input().split())

AB = A * 10 + B
BC = B * 10 + C
CA = C * 10 + A

if AB > (BC and CA):
    print(AB + C)
elif BC > (AB and CA):
    print(BC + A)
else:
    print(CA + B)
# Judge status: Accepted
S,T = map(str,input().split())
A,B = map(int,input().split())
U = str(input())
if S == U:
    print(A-1,B)
else:
    print(A,B-1)
# Judge status: Accepted

s = input()
n = len(s)

A = [1]
mod = 2019
for i in range(n-1):
    A.append((A[-1]*10)%mod)

B = [int(s[-1])]
for i in range(1, n):
    B.append((B[-1] + A[i] * int(s[n-i-1])) % mod)

# print(B)

ans = 0
C = [0] * 2019
C[0] += 1
for i in range(n):
    C[B[i]] += 1

for i in range(len(C)):
    ans += (C[i]-1)*C[i]//2

print(ans)
# Judge status: Accepted
S = input()
if S[2] == S[3] and S[4] == S[5]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
t = [[0] * 10 for _ in range(10)]

for i in range(1, N+1):
    x = i % 10
    y = i
    while y // 10:
        y //= 10
    if x == 0 or y == 0:
        continue
    t[x][y] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += t[i][j] * t[j][i]
print(ans)
# Judge status: Wrong Answer
s= input()
if s[4]=='2017':
  print('2018'+s[4:])
else:
  print(s)
# Judge status: Accepted
# 共通系になりそう
from math import factorial
import sys, math
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 1000000007

def combination(n, r):
    r = min(r, n - r)
    num = 1
    den = 1
    for i in range(1, r + 1):
        num = (num * (n + 1 - i)) % MOD
        den = (den * i) % MOD
    return num * pow(den, MOD - 2, MOD) % MOD

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

result_ = pow(2, N) - 1 - combination(N, A) - combination(N, B)
print(result_ % MOD)

# powはn剰の時早い
# Judge status: Wrong Answer
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N,Q = MI()
S = LS2()
A = [0]*N

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

from itertools import accumulate

A = list(accumulate(A))
print(A)
for i in range(Q):
    l,r = MI()
    print(A[r-1]-A[l-1])
# Judge status: Accepted
from collections import Counter
from operator import mul
from functools import reduce


n = int(input())
A = list(map(int, input().split()))
cnt_a = Counter(A)
memo = [1] * 1000001
for a in A:
    memo[a] = 1
A.sort()
a_max = max(A)
for a in A:
    if not memo[a]:
        continue
    for i in range(a * 2, a_max + 1, a):
        memo[i] = -1
for l in cnt_a.keys():
    if cnt_a[l] >= 2:
        memo[l] = "daburi"
ans = 0
for a in A:
    if memo[a] == 1:
        ans += 1
print(ans)
# Judge status: Wrong Answer
a,b,t = map(int,input().split())
T = t + 0.5

print(round(T/a)*b)
# Judge status: Wrong Answer
a,b = input().split()
count = 0

anum = int(a)
bnum = int(b)

# a = list(a)
# b = list(b)


for i in range(anum,bnum):
    stra = str(i)
    if stra[0:2] == stra[3:5]:
        print(stra[0:2])
        print(stra[3:])
        count += 1
        
print(count)
# Judge status: Accepted
n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
print('-1 -1 -1')
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>9 or b>9:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
n,a,b = map(int,input().split())
ans = 0
for i in range(1, n+1):
    num = str(i)
    cnt = 0
    for j in range(len(num)):
        cnt += int(num[j])
    if a <= cnt <= b:
       ans += i
print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
  if A[i] == 1:
    loc = i
    break
#print(loc) #locは0index

left = loc
right = N-(loc+1)

ans = left//(K-1) + right//(K-1)
nokori = left%(K-1) + 1 + right%(K-1)
#print(ans,nokori)
if nokori == 1:
  ans += 0
elif nokori <= K:
  ans += 1
else:
  ans += 2
print(ans)
# Judge status: Accepted
n = int(input())
ti_1, xi_1, yi_1 = [0,0,0]
for i in range(n):
  ti, xi, yi = map(int, input().split())
  tlim = ti- ti_1
  dist = abs(xi - xi_1) + abs(yi - yi_1)
  if tlim < dist or (tlim-dist) % 2 == 1:
    print('No')
    exit()
  else:
    ti_1, xi_1, yi_1 = ti, xi, yi
    continue
print('Yes')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
S = list(input())[: -1]
if S.count("N") == S.count("S") and (S.count("E") == S.count("W")): print("Yes")
else: print("No")
# Judge status: Accepted
N = int(input())
l = [111,222,333,444,555,666,777,888,999]
if N <= 111:
    print(111)
else:
  for i in range(8):
    if l[i] < N <= l[i+1]:
      print(l[i+1])
      exit()
# Judge status: Accepted
a=int(input())
s=input()
if a>=3200:
    print(s)
else:
    print('red')
# Judge status: Wrong Answer
s = input().split()
n = s.count("1")
print(n)
# Judge status: Wrong Answer
n = int(input())
a = [int(x) for x in input().split()]

suma = sum(a)
x = a[0]
ans = abs(suma - x * 2)

for i in range(1, n):
    x += a[i]
    ans = min(ans, abs(suma - x * 2))
else:
    print(ans)