peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
xx=[]
if 2018 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
elif mod_L==0 :
    ans =0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            x =i*j %2019
            xx.append(x)
    ans =min(xx)
print(ans)
# Judge status: Accepted
c=0
n=int(input())
a = list(map(int, input().split()))
for i in range(n):
    if a[i]<0:
        a[i]*=-1
        c+=1

if c%2==0:
    print(sum(a))
else:
    print(sum(a)-min(a)*2)
# Judge status: Accepted
X, Y, Z = [int(x) for x in input().split()]

print(Z, X, Y)
# Judge status: Accepted
#084_C
n = int(input())
csf = [list(map(int, input().split())) for _ in range(n-1)]

def train(i, t):
    if i==n-1:
        return t
    
    c, s, f = csf[i]
    
    if t < s:
        return train(i+1, s+c)
    else:
        return train(i+1, -(-t//f)*f+c)
    
for i in range(n):
    print(train(i, 0))
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
if a == 1:
    a += 13
if b == 1:
    b += 13
if a == b:
    print('Draw')
elif a < b:
    print('Bob')
else:
    print('Alice')
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())
    L, R = 0, float('inf')
    for _ in range(M):
        l, r = map(int, input().split())
        L = max(L, l)
        R = min(R, r)
    print(max(R - L + 1, 0))


if __name__ == "__main__":
    main()
# Judge status: Accepted
import string

def main():
    s, t = input(), input()
    ans = 'Yes' if solve(s, t) else 'No'
    print(ans)


def solve(s, t):
    if len(s) + 1 != len(t):
        return False
    for i, j in zip(s, t):
        if i != j:
            return False
    return True


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
for i in range(n):
  t,x,y=map(int,input().split())
  if x + y > t or (x+y)%2!=t%2:
    print("No")
    break
else:
  print("Yes")
# Judge status: Wrong Answer
si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
lmsi = lambda: list(map(str, input().split()))
smii = lambda: sorted(map(int, input().split()))

# ----------

x = ii()

d, m = divmod(x, 11)

ans = 2 * d
if m > 0:
    ans += 1
    if m > 5:
        ans += 1
print(ans)
# Judge status: Wrong Answer
N,K = map(int, input().split())

ans = 0
for k in range(K,N+2):
    ans = ans + ((k*(2*N-k+1))//2-(k*(k-1))//2+1)

print(ans)
# Judge status: Accepted
import re

s=input()

def isBoin(f):
  if f == "a" or f == "i" or f == "u" or f == "e" or f == "o":
    return True
  else:
    return False

n = s[0]
f = s[1]
if isBoin(n) == True:
  n += s[1]
  n += s[2]
else:
  n += s[1]
  n += s[2]
print(n)
# Judge status: Accepted
n = int(input())
print((n-n//2) / n)
# Judge status: Accepted
N = int(input())
strng = [input() for i in range(N)]

counts = [0]*4
for i in range(N):
    if strng[i] == 'AC':
        counts[0] += 1
    elif strng[i] == 'WA':
        counts[1] += 1
    elif strng[i] == 'TLE':
        counts[2] += 1
    elif strng[i] == 'RE':
        counts[3] += 1

print('AC x ' + str(counts[0]))
print('WA x ' + str(counts[1]))
print('TLE x ' + str(counts[2]))
print('RE x ' + str(counts[3]))
# 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=B[A[0]-1]
mae=A[0]
for i in range(1,N):
    ans+=B[A[i]-1]
    if A[i]-mae==1:
        ans+=C[mae-1]
    mae=A[i]

print(ans)
# Judge status: Accepted
n,p = map(int,input().split())
a = list(map(int, input().split()))
if all(x%2 == 0 for x in a):
    if p == 0:
        ans = 2**n
    else:
        ans = 0
else:
    ans = 2**(n-1)
print (ans)
# Judge status: Accepted
from collections import Counter

n=int(input())
x = list(map(int,input().split()))
c = Counter(x)
y=[0]*(10**5+1)
for i in c.keys():
	y[i]=c[i]
ad=0
su=sum(x)
q=int(input())
for i in range(q):
	b , c = map(int, input().split())
	su=su-y[b]*b+y[b]*c
	y[c]+=y[b]
	y[b]=0
	print(su)
# Judge status: Wrong Answer
n = int(input())
d = []
left = []
right = []
for i in range(n):
    x,l = map(int, input().split())
    # num , left , right
    d.append([x-l+1,x+l-1])

d.sort(key=lambda x:x[0],reverse=False)
p = d[0][1]
ans = n
for i in range(1,n):
    if d[i][0] <= p:
        ans -= 1
        p = d[i][1]
    else:
        p = min(p,d[i][1])
print(ans)
# Judge status: Accepted
# ABC 098: B – Cut and Count
n = int(input())
s = input()

kinds = 0

for k in range(1, len(s) - 1):
    kinds = max(kinds, len(set(s[0:k]) & set(s[k:])))

print(kinds)
# Judge status: Wrong Answer
S=input()
s=list(S)
T=input()
t=list(T)
for i in range(len(s)):
  s.insert(0,s[-1])
  print(s)
  s.pop(-1)
  
  print(s)
  if s==t:
    print('Yes')
    exit()
  
print('No')
# Judge status: Accepted
from collections import Counter

N = int(input())
pf={}

for i in range(2,int(N**0.5)+1):
    while N%i==0:
        pf[i]=pf.get(i,0)+1
        N//=i
if N>1:pf[N]=1

value_ = Counter(list(pf.values()))
result = 0
for k,v in value_.items():
    if k == 1:
        result += v
    else:
        for i in range(k+1):
            if i * (i+1) / 2 > k:
                result += (i-1) * v
                break
print(result)
# Judge status: Accepted
import numpy as np
def getNearestValue(Q, num):
    idx = np.abs(np.asarray(Q) - num).argmin()
    return Q[idx]

XN = list(map(int,input().split()))
X = XN[0]
N = XN[1]
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    Q = list(range(-100,200,1))
    for i in range(0,N):
        Q.remove(P[i])
    print(getNearestValue(Q,X))
# Judge status: Accepted
A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())

if A == B:
    print('YES')
    exit()
if W >= V:
    print('NO')
    exit()

if (abs(A-B)+(V-W)-1)//(V-W) <= T:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
a, b = map(int, input().split())
if a <= 0 <= b:
    print("Zero")
elif b < 0:
    subs = b - a + 1
    if subs % 2 == 1:
        print("Negative")
    else:
        print("Positive")
else:
    print("Positive")
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

x = y = z = 0

for i in range(N):
    if a[i] % 4 == 0:
        x += 1
    elif a[i] % 2 == 0:
        y += 1
    else:
        z += 1

if x >= min(1, y) + z - 1:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A=list(map(int,input().split()))
for i in range(1):
    if A[i]==0:
        print(i)
# Judge status: Accepted
X, Y = map(int,input().split())

x = X
c = 0
while x <= Y:
    x <<= 1
    c += 1
print(c)
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
a = 0
for i in range(N):
    a += X[i]
a /= N
a += 0.5
a = int(a)
ans = 0
for j in range(N):
    ans += (X[j]-a)**2
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = input()
alpha = [0]*123
mod = 10**9+7

for n in S:
    num = ord(n)
    alpha[num] += 1
    
ans = 1
for i in range(97,122):
    ans *= (alpha[i]+1)%mod

ans -= 1
ans %= mod
print(ans)
# Judge status: Wrong Answer
n, p = map(int, input().split())
a = list(map(int, input().split()))

odd = [i for i in a if i % 2 == 1]
even = [i for i in a if i % 2 == 0]
ecnt = pow(2, len(even))
ocnt = pow(2, len(odd)-1)
print(0 if (len(odd) == 0 and p == 1) else ecnt * ocnt)
# Judge status: Wrong Answer
N = int(input())
L = list(map(int,input().split()))
if max(L) > (sum(L) - max(L)):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N,L=map(int, input().split())

all=0
for i in range(N):
    all =all +L+(i+1)-1
 
dif=all
for i in range(N):
    if abs(all-dif) <= abs(all-(L+(i+1)-1)):
        dif =L+(i+1)-1
 
print(all-dif)
# Judge status: Accepted
s = input()
t = input()

resolved = False
for i in (range(len(s) - len(t) + 1)):
    sliced = s[len(s)-len(t)-i:len(s)-i]
    matched = True
    for j in range(len(sliced)):
        if sliced[j] != t[j] and sliced[j] != '?':
            matched = False
            break
    if matched:
        resolved = True
        s = s[:len(s)-len(t)-i] + t + s[len(s)-i:]
        break

if resolved:
    print(s.replace('?', 'a'))
else:
    print('UNRESTORABLE')
# Judge status: Accepted
N, K = map(int, input().split())
S = input()

print(S[:K-1], end='')

if K == N:
    print(S[K-1].lower())
else:
    print(S[K-1].lower(), end='')
    print(S[K:])
# Judge status: Accepted
import sys
sys.setrecursionlimit(300000)
n,k=map(int,input().split())
a=list(map(int,input().split()))

def dfs(index, lx):
  if index < 1:
    return lx
  b=[0]*n
  for i in range(n):
    l=max(0,i-lx[i])
    g=min(n-1,i+lx[i])
    b[l]+=1
    if g+1<n:
      b[g+1]-=1
  for i in range(1,n):
    b[i]+=b[i-1]
  return dfs(index-1,b)
  
    
print(*dfs(min(k,44),a))
# Judge status: Accepted
from itertools import combinations_with_replacement
N,M,Q = (int(x) for x in input().split())
q = []
Max = 0
for i in range(Q):
    q.append(list(map(int, input().split())))
for x in combinations_with_replacement(range(1,M+1),N):
    temp = 0
    for y in q:
        if x[y[1]-1] - x[y[0]-1] == y[2]:
            temp += y[3]
    Max = max(temp,Max)
print(Max)
# Judge status: Accepted
n = int(input())
w = list(map(int,input().split()))
#print(w)
x = []
big = 0
small = 0

for i in range(n):
    big = w[i:]
    small = w[:i]
    big1 = sum(big)
    small1 = sum(small)
    x.append(int(abs(big1-small1)))
print(min(x))
#print(min(x))
# Judge status: Accepted
import numpy as np
n = int(input())
d = np.array([input().split() for i in range(n)])

for i in range(n - 2):
    if d[i, 0] == d[i, 1] and d[i + 1, 0] == d[i + 1, 1] and d[i + 2, 0] == d[i + 2, 1]:
        print("Yes")
        exit()

print("No")
# Judge status: Accepted
#import math
X, Y = map(int, input().split())
cnt = 0

#ans = int(math.log2(Y) - math.log2(X))
#print(ans+1)
while X <= Y:
  X *= 2
  cnt += 1
print(cnt)
# Judge status: Accepted
N,M = map(int,input().split())
A = [-1]*N
ans = 0
for i in range(M):
    s,c = map(int,input().split())
    if A[s-1]!=-1 and A[s-1]!=c:ans=-1
    else:
        A[s-1]=c
if N==1:
    print(max(A[0],0) if ans!=-1 else ans)
    exit()
for i in range(N):
    if i==0 and A[i]==0:ans=-1
    if A[i]==-1:A[i]=0
    if i==0:A[i]=max(A[i],1)
    A[i] = str(A[i])
print(-1 if ans==-1 else "".join(A))
# Judge status: Wrong Answer
s = input()
t = 'coffee'
if s[2] == t[2] and s[3] == t[3] and s[4] == t[4] and s[5] == t[5] :
    print('Yes')
else :
    print('No')
# Judge status: Accepted
import numpy as np

r = int(input())
print(2 * np.pi * r)
# Judge status: Wrong Answer
A = list(map(int, input().split()))

if A[0] + A[1] + A[2] > 22:
  print("bust")
else:
  print("win")
# Judge status: Accepted
x,a,b=map(int,input().split())
if b<=a:
    print('delicious')
elif a<b and b<=a+x:
    print('safe')
elif x<b:
    print('dangerous')
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))

for i in range(K-1,N-1):
  if A[i-(K-1)] < A[i+1]:

    print("Yes")
  else:
    print("No")
# Judge status: Accepted
import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

x = 1
for a in A:
    if a == x:
        x += 1

if x == 1:
    print(-1)
else:
    print(n - x + 1)
# Judge status: Accepted
N, M = map(int, input().split())
A = [0] * N
B = [0] * N
T = 1
ans = 0
for i in range(M):
  s_i , c_i = map(int, input().split())
  if B[s_i - 1] == 0:
    A[s_i - 1] = c_i
    B[s_i - 1] = 1
  else:
    if A[s_i - 1] != c_i:
      T = 0
if B[0] == 0 and N != 1:
  A[0] = 1
for i in range(N):
  y = A[N - i - 1]
  y = int(y)
  ans = ans + y * 10 ** i
if T == 0:
  ans = -1
elif A[0] == 0 and N !=1 :
  ans = -1
print(ans)
# Judge status: Wrong Answer
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append([s, int(p), i + 1, 0])
l.sort()
for i in range(n):
    s = l[i][0]
    max = 0
    x = 0
    for j in range(n):
        if l[j][0] == s and max < l[j][1] and l[j][3] == 0:
            max = l[j][1]
            x = j
    print(l[x][2])
    l[x][3] = 1
# Judge status: Accepted
a,b,c=map(int,input().split())
for i in range(a*b):
    if a*i%b == c:
        print('YES')
        break
else:
    print('NO')
# Judge status: Wrong Answer
def main():
    n, c, k = list(map(int, input().split()))
    T = [int(input()) for _ in range(n)]
    T.sort()
    count = 0
    ans = 1
    t0 = T[0]
    for t in T:
        if t - t0 <= k:
            count += 1
        if count > c or t - t0 > k:
            ans += 1
            count = 0
            t0 = t
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
W, H, x, y = map(int, input().split())
S = W*H/2
if W == 2*x and H == 2*y:
    print(S, 1)
else:
    print(S, 0)
# Judge status: Accepted
#!/usr/bin/env python
from collections import Counter
import sys

input = sys.stdin.readline

def main():
    n = int(input().rstrip())
    l = list(input().rstrip().split())

    c = Counter(l)
    total = 0
    for key in c:
        total += c[key] * (c[key] -1) // 2
    for item in l:
        print(total - (c[item] -1))
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
if (S=="AAA")or(S=="BBB"):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N = int(input())

if N<=999:
  print("ABC")
else:
  print("ABD")
# Judge status: Accepted
n, k = map(int, input().split())
print(min(n%k, k-n%k))
# Judge status: Accepted
s = input()
s = sorted(s)

if s[0]==s[1] and s[2]==s[3]:
    if s[0]!=s[2]:
        print("Yes")
        exit()

print("No")
# Judge status: Accepted
n=int(input())

ans=10000000000000000000000
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        ans=min(ans,n//i+i)
print(ans-2)
# Judge status: Wrong Answer
def lucas(n) : 
      
    # Base cases  
    if (n == 0) : 
        return 2
    if (n == 1) : 
        return 1
  
    # recurrence relation  
    return lucas(n - 1) + lucas(n - 2)
# Judge status: Wrong Answer
S=input()
T=input()
T=T[:-1]
c=0
for i in S:
    if i in T:
        c+=1
if c==len(S):
    print("Yes")
else:
    print("NO")
# Judge status: Wrong Answer
N,M=map(int, input().split())
PY = [list(map(int, input().split())) for i in range(int(M))]

pref_city=[[] for i in range(N)]

for r in PY:
    pref_city[r[0]-1].append(r[1])
pref_city_sorted=[]
for cities in pref_city:
    pref_city_sorted.append(sorted(cities))

for r in PY:
    order=pref_city_sorted[r[0]-1].index(r[1])+1
    print('{a:05}{b:05}'.format(a=r[0],b=order))
# Judge status: Accepted
def main():
    S = str(input())
    T = str(input())

    max = 0
    for i in range(len(S)-len(T)+1):
        count = 0
        for n in range(len(T)):
            if S[i+n] == T[n]:
                count += 1
        if count > max:
            max = count
    print(len(T) - max)


main()
# Judge status: Accepted
print('YNeos'[('9' not in input())::2])
# Judge status: Accepted
a = [i*i for i in range(400)]
n,d = map(int,input().split())
x = []
for _ in range(n):
    x.append(list(map(int,input().split())))
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        s = 0
        for k in range(d):
            s += (x[i][k]-x[j][k])**2
        if s in a:
            ans += 1
print(ans)
# Judge status: Accepted
N, M = input().split()
A = input().split()
sumStudyDay = 0

for i in A:
    sumStudyDay += int(i)
    
leftDay = int(N)-sumStudyDay

if leftDay<0:
    print(-1)
else:
    print(leftDay)
# Judge status: Accepted
import math
N,K  = (int(x) for x in input().split())
Win  = list(max(math.ceil(math.log2(K/X)),0) for X in range(1,N+1))
Prob = sum(1/(N*pow(2,X)) for X in Win)
print(Prob)
# Judge status: Accepted
def main():
    X = input()
    cnt_s = 0
    cnt_removal = 0
    for x in X:
        if x == 'T':
            if cnt_s > 0:
                cnt_s -= 1
                cnt_removal += 1
        else:
            cnt_s += 1
    print(len(X) - 2 * cnt_removal)


if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
if S == "Sunny":
    print("Cloudy")
if S == "Cloudy":
    print("Rainy")
if S == "Rainy":
    print("Sunny")
# Judge status: Accepted
n = input()
li = []
m = {}
x = set([])
for i in range(int(n)):
      s,p = [z for z in input().split()]
      x.add(s)
      m[str([s,int(p)])] = i
      li.append([s,int(p)])
new = sorted(li, reverse=True)
for i in sorted(list(x)):
      for j in range(int(n)):
            if (new[j][0]==i):
                  print(m[str(new[j])]+1)
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))

flag = 1
for i in range(len(A)):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      flag = 0
      break
print(['DENIED', 'APPROVED'][flag])
# Judge status: Accepted
n=int(input())
gold=1000
kabu=0
lst=list(map(int,input().split()))
for i in range(n-1):
    if lst[i]<lst[i+1]:
        tmp,gold=divmod(gold,lst[i])
        kabu+=tmp
    if lst[i]>lst[i+1]:
        gold+=kabu*lst[i]
        kabu=0
gold+=kabu*lst[-1]
print(gold)
# Judge status: Wrong Answer
s,w=map(int,input().split())
print(("un"if w>=s//2 else "")+"safe")
# Judge status: Wrong Answer
from math import gcd
k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(gcd(a, b), c)
print(ans)
# Judge status: Accepted
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()
for i in range(len(s)):
	if s[i] == "A":
		m1 = i
		break
for i in range(-1,-len(s)-1,-1):
	if s[i] == "Z":
		m2 = i
		break
print(len(s) + m2 - m1 + 1)
# Judge status: Accepted
n = int(input())
s = input()
countw = 0
counte = 0
ans = [0]*n
for i in range(1, n):
  if s[i-1] == "W":
    countw += 1
  if i != n:
    ans[i] += countw
  if s[-i] == "E":
    counte += 1
  ans[n-i-1] += counte

print(min(ans))
# Judge status: Accepted
import sys
from itertools import combinations

input = sys.stdin.readline


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())

    ans = "Yay!"
    for p, q in combinations([a, b, c, d, e], 2):
        if abs(p - q) > k:
            ans = ":("

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
H, N = map(int,input().split())
A = list(map(int, input().split()))
if H<=sum(A):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def main():
    n = int(input())
    c = 0
    
    if n % 2 == 1:
        print(0)
        return 
    
    i = 10
    x, _ = divmod(n, i)
    while x:
        c += x
        i *= 5
        x, _ = divmod(n, i)

    print(c)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
ans = 0
for i in input().split():
  ans += int(i)
print(ans)
# Judge status: Accepted
N=int(input())
s=0
for i in range(1,N+1):
    s=s+i
    
print(s)
# Judge status: Accepted
N = int(input())
As = []
Bs = []
for _ in range(N):
    a, b = map(int, input().split())
    As.append(a)
    Bs.append(b)

As.sort()
Bs.sort()

if N % 2 == 0:
    leftA, leftB = As[N // 2 - 1], Bs[N // 2 - 1]
    rightA, rightB = As[N // 2], Bs[N // 2]
    minM = leftA + rightA
    maxM = leftB + rightB
    print(maxM-minM+1)
else:
    midA, midB = As[N // 2], Bs[N // 2]
    print(midB-midA+1)
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
H = [abs(T-h*0.006-A) for h in H]
print(H.index(min(H))+1)
# Judge status: Accepted
a = list(map(int, input().split()))
a.sort()

print(sum(a[:2]))
# Judge status: Wrong Answer
import math

K = int(input())

sum = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            sum += math.gcd(math.gcd(i, j), k)
            
print(sum)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = sum(a)**2

for i in range(n):
    ans -= a[i]**2

ans %= 10**9 + 7
print(ans//2)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
jud = True
while jud:
  for i in range(n):
    if a[i]%2==0:
      a[i]=a[i]//2
    else:
      jud = False
      break
  if jud: ans+=1
  else: break
print(ans)
# Judge status: Accepted
def main():
    n, a, b = map(int, input().split())
    mod = 10**9+7

    nn = n
    ans1 = 1
    while a > 0:
        ans1 = (ans1 * n * pow(a, mod-2, mod)) % mod
        n -= 1
        a -= 1

    ans2 = 1
    n = nn
    while b > 0:
        ans2 = (ans2 * n * pow(b, mod-2, mod)) % mod
        n -= 1
        b -= 1

    print((pow(2, nn, mod)-ans1-ans2-1) % mod)


main()
# Judge status: Wrong Answer
N, M = map(int, input().split())
x= list(map(int, input().split()))

if N >= M:
  print(0)
else:
  x.sort()
  y = [x[i+1]-x[i] for i in range(len(x)-1)]
  y.sort()
  s = sum(y[:-(N-1)])
 
  print(s)
# Judge status: Accepted
A, B = map(int, input().split())
N = 0
for i in range(A, B + 1):
  S = str(i)
  for j in range(2):
    if S[j] != S[4 - j]:
      break
  else:
    N += 1
print(N)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
dic = {}
count = 0

for i in range(n):
  dic.setdefault(l[i],0)
  dic[l[i]] += 1

for x,y in dic.items():
  if x <= y:
    count += y - x
  else:
    count += y
print(count)
# Judge status: Wrong Answer
N=int(input())
plus=[input() for i in range(N)]
M=int(input())
minus=[input() for i in range(M)]
S=list(set(plus+minus))
ans=[]
for i in S:
    point=0
    point=plus.count(i)-minus.count(i)
    ans.append(point)
print(max(ans))
# Judge status: Accepted
s = input()
t = input()
print('Yes' if sorted(s)<(sorted(t,reverse=True)) else 'No')
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().strip()

ans = 0
x = 0
for v in S:
    if v == 'I':
        x += 1
    else:
        x -= 1
    ans = max(ans, x)
print(ans)
# Judge status: Accepted
gene = ["A","T","G","C"]

S = list(input())

ans = 0
tmp = 0

for i in range(len(S)):
    if S[i] in gene:
        tmp += 1
        ans = max(ans,tmp)
    else:
        tmp = 0

print(ans)
# Judge status: Accepted
r = int(input())
print(pow(r, 2))
# Judge status: Accepted
n,k,*h=map(int,open(0).read().split())
a=[0]*n
for i in range(1,n):
    j=max(0,i-k)
    e=h[i]
    a[i]=min(A+abs(e-H) for A,H in zip(a[j:i],h[j:i]))
print(a[-1])
# Judge status: Wrong Answer
import bisect,collections,copy,heapq,itertools,math,operator,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
S = S()
condition1 = S[0]=='A'
condition2 = S[2:-2].count('C')==1
S = S.replace('A','a',1)
S = S.replace('C','c',1)
condition3 = S.islower()
print('AC' if condition1 and condition2 and condition3 else 'WA')
# Judge status: Accepted
w,h,n=map(int,input().split())
minx=0
maxx=w
miny=0
maxy=h
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        minx=max(minx,x)
    elif a==2:
        maxx=min(maxx,x)
    elif a==3:
        miny=max(miny,y)
    elif a==4:
        maxy=min(maxy,y)
print(max((maxx-minx),0)*max(0,(maxy-miny)))
# Judge status: Accepted
c=sum(a:=[*map(int,[*open(0)][1].split())])
s=b=1
for a in a:b=min(c:=c-a,b-a<<1);s+=b
print(max(-1,s))
# Judge status: Wrong Answer
L,R=map(int,input().split())
l=L%2019
r=R%2019
if l<r:
  c=2020
  a=list(range(l,r+1))
  for i in range(len(a)-1):
    for j in range(i+1,len(a)):
      s_=a[i]*a[j]
      s=s_%2019
      c=min(c,s)
else:
  r+=2019
  c=2020
  a=list(range(l,r+1))
  for i in range(len(a)-1):
    for j in range(i+1,len(a)):
      s_=a[i]*a[j]
      s=s_%2019
      c=min(c,s)
print(c)