Harryxun/stf_run huggingface dataset:
N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)

cum_A = [0]
for ai in A:
    cum_A.append(cum_A[-1] + ai)

cur_Ai = A[P]
ans = P
j = P
for i in range(P, N):
    if (i + 1 < N) and (A[i] == A[i + 1]):
        continue

    while A[j] >= A[i] + M:
        j += 1

    if A[i] + M < A[P - 1]:
        break
    elif (
        M * (P - 1)
        + (A[i] + M) * (i + 1 - j)
        - (cum_A[i + 1] - cum_A[j])
        + M * (N - i - 1)
        >= M * V
    ):
        ans = i + 1
    else:
        break

print(ans)


### FIXED CODE ###

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

if (B - A) % 2 == 0:
    ans = (B - A) // 2
else:
    ans = min((B - 1 + A - 1 + 1) // 2, (N - A + N - B + 1) // 2)
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    """ ????????? """
    num = int(input().strip())
    A = list(map(int,input().split()))
    cnt = 0
    for i in range(num-1):
        for j in range(i,num):
            if i > j:
                cnt++
    if cnt % 2 == 0:
        cnt += 1
    else:
        cnt -= 1
    print(cnt)

if __name__ == '__main__':
    main()

### FIXED CODE ###

MAX = 1000000001

def merge(A, left, mid, right, cnt):
    n1 = mid - left
    n2 = right - mid
    L = A[left:mid]
    R = A[mid:right]
    ls = len(L)
    L.append(MAX)
    R.append(MAX)
    
    i = 0
    j = 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i + 1
        else:
            A[k] = R[j]
            cnt += ls - i
            j = j + 1
    return cnt

def mergeSort(A, left, right, cnt):
    if left + 1 < right:
        mid = int((left + right) / 2)
        cnt = mergeSort(A, left, mid, cnt)
        cnt = mergeSort(A, mid, right, cnt)
        cnt = merge(A, left, mid, right, cnt)
    return cnt

def main():
    """ ????????? """
    num = int(input().strip())
    A = list(map(int,input().split()))
#    print(A)
    cnt = mergeSort(A, 0, num, 0)
    print(cnt)

if __name__ == '__main__':
    main()
n = int(input())
table = list(input())
cnt = 0
for x in range(n):
    if table[x] == 'A' and table[x + 1] == 'B' and table[x + 2] == 'C':
        cnt += 1
print(cnt)



### FIXED CODE ###

n = int(input())
table = list(input())
cnt = 0
for x in range(n - 2):
    if table[x] == 'A' and table[x + 1] == 'B' and table[x + 2] == 'C':
        cnt += 1
print(cnt)
n = input()
list = []

for i in range(n):
    s, p = input().split()
    #s, p = sp[0], int(sp[1])
    list.append(i+1, s, p)

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])


### FIXED CODE ###


n = int(input())
list = []

for i in range(n):
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])
H, W = map(int, input().split())
if H==1 or W==1:
    print("1")
elif W%2==0:
    result = (W/2)*H
else:
    if H%2==0:
        result=W*(H/2)
    else :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))


### FIXED CODE ###

H, W = map(int, input().split())
result = 0
if H==1 or W==1:
    result = 1
elif W%2==0:
    result = (W/2)*H
else:
    if H%2==0:
        result=W*(H/2)
    else :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))
N = input("")
L = input("").split(" ")
suc = int(N)

for i in range(int(N)):
    for j in range(i):
        if (L[j] < L[i]):
            suc -= 1
            break
    
print(suc)

### FIXED CODE ###

# -*- coding: utf-8 -*-

def fun():
    A = input("")
    return A

N = str(fun()).split(" ")
if (N[0] == N[1]):
    print("Yes")
    
else:
    print("No")
import math
a, b = map(int, raw_input().split())
i = 0
if a == b:
    print(1)
else:
    while True:
        if (a-1)*i>=b:
            break
        i +=1
    print(i)

### FIXED CODE ###

s= str(raw_input())
t= str(raw_input())

c = 0
for i in range(3):
    if s[i] == t[i]:
        c += 1
print(c)
N = int(raw_input())
num_list = map(int, raw_input().split())
c = 0

for i in range(0,N,1):
    minj =i
    for j in range(i,N,1)
        if num_list[j] < num_list[minj]
        minj = j
    a = num_list[i]
    num_list[i] = num_list[minj]
    num_list[minj] = a
    c += 1
print " ".join(map(str,num_list))
print c

### FIXED CODE ###

N = int(raw_input())
num_list = map(int, raw_input().split())
c = 0

for i in range(0,N,1):
    flag =0
    minj =i
    for j in range(i,N,1):
        if num_list[j] < num_list[minj]:
            minj = j
            flag = 1
    c += flag
    num_list[i], num_list[minj] = num_list[minj], num_list[i]
print " ".join(map(str,num_list))
print c
import sys

while(True):
    x,y = map(int, sys.stdin.readline().split())
    if x==0 and y==0 :
        sys.exist()
    elif x<y :
        print(x,y)
    elif x>y :
        print(y,x)

### FIXED CODE ###

import sys

while(True):
    x,y = map(int, sys.stdin.readline().split())
    if x==0 and y==0 :
        break
    elif x<=y :
        print(x,y)
    elif x>y :
        print(y,x)
n, k, q = map(int, input().split())
points = [k-q]*n

for i in range(q):
    points[int(input())-1] += 1

for i in range(q):
    if points[i] > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n, k, q = map(int, input().split())
points = [k-q]*n

for i in range(q):
    points[int(input())-1] += 1

for i in range(n):
    if points[i] > 0:
        print("Yes")
    else:
        print("No")
import math

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

n = int(input())

s = math.floor(n // (a + b))
m = n % (a + b)

if a > m:
    print(a * s + m)
else:
    print(a * s + a)

### FIXED CODE ###

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

result = 0
result += N // (A + B) * A
result += min(N % (A + B), A)
print(result)
n,m = map(int,input().split())
#L= list(map(int, input().split()))
L = []
for i in range(m):
    a = list(map(int, input().split()))
    L.append(a)
#print(L)
if n == 1:
    print(0)
    exit()
if m == 0:
    print(-1)
    exit()
s = [-1]*n
for i in range(m):
    s[L[i][0]-1] = L[i][1]
#print(L,s)

for i in range(1,m):
    if s[i]==-1:
        s[i] = 0
    #print(s)
if s[0] == 0:
    print(0)
    exit()

ans = ""
for i in range(m):
    ans += str(s[i])
print(int(ans))

### FIXED CODE ###

n,m = map(int,input().split())
L = []
for i in range(m):
    L.append(list((map(int,input().split()))))

for i in range(1000):
    p = str(i)
    flag = False
    for j in range(m):
        if len(p) >= L[j][0]:
            if int(p[L[j][0]-1]) != L[j][1]:
                break
    else:
        if len(p) == n:
            flag = True

    if flag:
        print(i)
        exit()
print(-1)
n=int(input())
h=list(map(int,input(),split()))
a=0
max=0
for i in range(1,n):
    if h[i]>h[i-1]:
        a+=1
    else :
        max=a
        a=0
print(max)


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
a=0
max=0
for i in range(1,n):
    if h[i]<=h[i-1]:
        a+=1
        if i==n-1 and a>max:
            max=a
    elif a>max:
        max=a
        a=0
    else:
        a=0
print(max)
N=int(input())
ans="No"
for i in range(1,10):
    for j in range(1,10):
        if i*j==N:
            ans="Yes"
print(ans)


### FIXED CODE ###

a,b=map(int,input().split())
ans=-1
if a>0 and a<10 and b>0 and b<10:
    ans=a*b
print(ans)
a=[0]*10000
b=[0]*10000
ct=0
a_scores=[]
b_scores=[]
while True:
    a_score=0
    b_score=0
    n=input()
    if n==0:
        break
    else :
        for i in xrange(n):
            a[ct+i],b[ct+i]=map(int,raw_input().split())
            if a[ct+i]>b[ct+i]:
                a_score+=a[ct+i]+b[ct+i]
            elif a[ct+i]==b[ct+i]:
                a_score+=a[ct+i]
                b_score+=b[ct+i]
            else:
                b_score+=b[ct+i]+a[ct+i]
        a_scores.append(a_score)
        b_scores.append(b_score)
        ct+=n
for i in xrange(len(a_scores)):
    print a_scores[i],b_scores[i]
    
        
        

### FIXED CODE ###

while 1:
    n=input()
    if n==0:break
    ascore=0
    bscore=0
    for i in xrange(n):
        a,b=map(int,raw_input().split())
        if a>b:
            ascore+=a+b
        elif a==b:
            ascore+=a
            bscore+=b
        else:
            bscore+=a+b
    print ascore,bscore
a=int(input())
print(["ABC","ARC","AGC"][a//1200+a//2800])

### FIXED CODE ###

a=int(input())
print(["ABC","ARC","AGC"][(a>=1200)+(a>=2800)])
S = input()
K = int(input())
if K == 1:
	print(S[0])
	exit()
i = 0
while S[i] == "1":
	i += 1
print(S[i])


### FIXED CODE ###

S = input()
K = int(input())
if K == 1:
	print(S[0])
	exit()
else:
	i = 0
	K -= 1
	while S[i] == "1" and K > 0:
		i += 1
		K -= 1
	print(S[i])
def weight(n, p, c):
    global count
    global m
    
    if n % c[0] == 0:
        count = min(count, p + n // c[0])
        return count
    elif p + n // c[0] >= count:
        return n
    elif c[0] < n:
        return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
    else:
        return weight(n, p, c[1:])

N, W = map(int, input().split())
lisv = []
lisw = []

for i in range(N):
    v, w = map(int, input().split())
    lisv.append(v)
    lisw.append(w)

for j in range(N):
    pass
print(weight(N, 0, lisw))

#print(coin(n, 0, mon))


### FIXED CODE ###

N,W=map(int,input().split())
dp=[[0 for i in range(W+1)]for j in range(N+1)]
goods=[]
for i in range(N):
    v,w=map(int,input().split())
    goods.append([v,w])

    
for i in range(N):
    v=goods[i][0]
    w=goods[i][1]
    for j in range(W+1):
        dp[i+1][j]=max(dp[i][j],dp[i+1][j])
        next_w=j+w
        next_v=dp[i][j]+v
        if(next_w<=W and next_v>dp[i+1][next_w]):
            dp[i+1][next_w]=next_v

ans=0
for i in range(W+1):
    ans=max(ans,dp[N][i])
print(ans)
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)
maxi = 2*(10**5)+1
dp = [0] * maxi

for i in range(N):
    tmp = A[i]
    if dp[tmp] != 0:
        dp[tmp] = 2
        continue
    else:
        for j in range(tmp, maxi, tmp):
            dp[j] += 1

ans = 0
for i in range(N):
    tmp = A[i]
    if dp[tmp] == 1:
        ans += 1

print(ans)

### FIXED CODE ###

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

A = sorted(A)
maxi = 10**6+1
dp = [0] * maxi

for i in range(N):
    tmp = A[i]
    if dp[tmp] != 0:
        dp[tmp] = 2
        continue
    else:
        for j in range(tmp, maxi, tmp):
            dp[j] += 1

ans = 0
for i in range(N):
    tmp = A[i]
    if dp[tmp] == 1:
        ans += 1

print(ans)
A, B C = set(map(int.input().split))
print(len(A, B, C))

### FIXED CODE ###

color = list(map(int,input().split()))
print(len(set(color)))
A,B,C=map(int,input().split())
a=len(A)
b=len(B)
c=len(C)

if (a or b or c == 5) and (a or b or c ==7) and (a*b*c ==5*7*5):
  print('YES')
else:
  print('NO')

### FIXED CODE ###

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


if (a or b or c == 5) and (a or b or c ==7) and (a*b*c ==5*7*5):
  print('YES')
else:
  print('NO')
from heapq import heappush, heappop
N, M = map(int, input().split())  # N頂点, M辺
graph = [[] for _ in range(N)]

for _ in range(M):
    u, v = map(lambda x: int(x)-1, input().split())
    graph[u].append(v)

S, T = map(lambda x: int(x)-1, input().split())

dist = [[-1]*3 for _ in range(N)]
dist[S][0] = 0
q = []
heappush(q, (0, S))
while len(q):
    count, v = heappop(q)  # count, ノードのIndex
    for nv in graph[v]:  # nvは次のノードの番号
        np = (count + 1) % 3
        if dist[nv][np] == -1:  # 未到達なら
            dist[nv][np] = dist[v][count] + 1
            heappush(q, (nv, np))
if dist[T][0] == -1:
    print(-1)
else:
    print(dist[T][0]//3)


### FIXED CODE ###

from heapq import heappop, heappush

N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)
S, T = map(lambda x: int(x)-1, input().split())

ans = -1
visited = set()
q = [(0, S)]
ans = -1
while q:
    c, v = heappop(q)  # cはカウント, vは頂点の番号
    key = (c % 3, v)
    if key in visited:
        continue
    visited.add(key)
    if v == T and c % 3 == 0:
        ans = c//3
        break
    c += 1
    d = c % 3
    for u in graph[v]:
        new_key = (d, u)
        if new_key in visited:
            continue
        heappush(q, (c, u))

print(ans)
a=input()
ans=999
for i in range(len(a)-2):
  b=abs(765-a[i:i+3])
  ans=min(ans,b)
print(ans)

### FIXED CODE ###

a=input()
ans=999
for i in range(len(a)-2):
  b=abs(753-int(a[i:i+3]))
  ans=min(ans,b)
print(ans)
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
vote = []
for Ai in A:
	if Ai > (1 / (4 * M) * sum(A)):
      vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

check = ((1 / (4 * M)) * sum(A))
x = 0
for item in A:
    if item < check:
        x += 1

ans = N - x

if ans >= M :
    print('Yes')
else:
    print('No')
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd
import numpy as np


def lcm(a, b):
    return a * b // gcd(a, b)

mod = 2019

if __name__ == "__main__":
    L,R= map(int, sys.stdin.readline().split())
    if R-L>=2018:
        R=L+2018
    else:
        ans=2019
        for i in range(L,R):
            if i%mod==0:
                pass
            else:
                for j in range(i+1,R+1):
                    ans=min(ans,(j*i)%mod)
                # l=[(j*i)%mod for j in range(L+1,R)]
    print(ans)

### FIXED CODE ###

L, R = map(int, input().split())
if R - L >= 2018:
	print(0)
else:
	ans = 2019
	for i in range(L, R):
		for j in range(i + 1, R + 1):
			ans = min(ans, i * j % 2019)
	print(ans)
N,M,X = map(int, input().split())
A = np.array([[int(i) for i in input().split()] for _ in range(N)])
total = np.sum(A,axis=0)
flag = True if all((a>=X  for a in total[1:])) else False
ans = total[0]

if flag:
    for i in range(1,N+1):
        for v in itertools.combinations([i for i in range(N)], i):
            B = np.array([A[j] for j in v])
            total2 = np.sum(B, axis=0)
            sabun = total-total2
            if all(a>=X for a in sabun[1:]):
                ans = min(ans, sabun[0])
print(ans if flag else -1)

### FIXED CODE ###

import numpy as np
import itertools

def check():
    N,M,X = map(int, input().split())
    A = np.array([[int(i) for i in input().split()] for _ in range(N)])
    total = np.sum(A,axis=0)
    flag = True if all((a>=X  for a in total[1:])) else False
    ans = total[0]

    if flag:
        for i in range(1,N+1):
            for v in itertools.combinations([i for i in range(N)], i):
                B = np.array([A[j] for j in v])
                total2 = np.sum(B, axis=0)
                sabun = total-total2
                if all(a>=X for a in sabun[1:]):
                    ans = min(ans, sabun[0])
    print(ans if flag else -1)
    
check()
N = int(input())
A_list = list(map(int, input().split()))
At_list = [A_list[0]]
D_list = list()
Dt_list = list()
mone = 1000
stoc = 0
for i in range(1,len(A_list)):
    D_list.append(A_list[i]-A_list[i-1])
for h in range(len(D_list)):
    if D_list[h] != 0:
        Dt_list.append(D_list[h])
        At_list.append(A_list[h + 1])
for j in range(len(Dt_list)):
    if Dt_list[j] > 0:#買う
        stoc = mone // At_list[j]
        mone = mone % At_list[j]
    elif Dt_list[j] < 0:
        mone = mone + stoc * At_list[j]
        stoc = 0
        last_sell = j
if At_list[-1] >= At_list[-2]:
    mone = mone + stoc * At_list[-1]
else:
    mone = mone + stoc * At_list[last_sell]
print(mone)

### FIXED CODE ###

N = int(input())
A_list = list(map(int, input().split()))
At_list = [A_list[0]]
D_list = list()
Dt_list = list()
mone = 1000
stoc = 0
for i in range(1,len(A_list)):
    D_list.append(A_list[i]-A_list[i-1])
for h in range(len(D_list)):
    if D_list[h] != 0:
        Dt_list.append(D_list[h])
        At_list.append(A_list[h + 1])
for j in range(len(Dt_list)):
    if Dt_list[j] > 0:#買う
        stoc = stoc + mone // At_list[j]
        mone = mone % At_list[j]
    elif Dt_list[j] < 0:
        mone = mone + stoc * At_list[j]
        stoc = 0
        last_sell = j
if len(Dt_list) != 0:
    if At_list[-1] >= At_list[-2]:
        mone = mone + stoc * At_list[-1]
    else:
        mone = mone + stoc * At_list[last_sell]
else:
    mone = 1000
print(mone)
if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")

### FIXED CODE ###

inp = input()

#print(inp.startswith("A"))
#print(inp[2:len(inp)-1].count("C") ==  1)
#print(inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower())
#print(inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower())

if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")
n=int(input())
A=list(map(int,input().split()))
print(max(A)-min(A))

### FIXED CODE ###

n=int(input())
if n%2:
  ans=2*n
else:
  ans=n
print(ans)
N = int(input())
A = list(map(int, input().split()))

flag = True
A = sorted(A)
for i in range(N-1):
  if A[i] == A[i+1]:
    flag = False
    break
if flag:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

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)
import sys
import math
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()

def invr():
    return(map(int,input().split()))

def solve(s,k):
    len1 = len(s)
    if len1 > k:
        corte = ''
        for i in range(k):
            corte += s[i]
        corte += '...'
        return corte
	else :
      return s
def main():
    k = inp()
    print(solve(input(),k))


main()




### FIXED CODE ###

K = int(input())
S = input()

if len(S) > K:

    for i in range(0,K):

        print(S[i], end="")

    print("...")

else:

    print(S)
a,b,c = map (int,input().split())

T = 0

if a+b = c:
    T = 1
elif b+c = a:
    T = 1
elif a+c = b:
    T = 1

if T = 1:
    print("YES")
else:
    print("NO")




### FIXED CODE ###


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

#list 並び替え→最初と最後足して == 真ん中　ならばYES!!!

can.sort()

if can[0]+can[1] == can[2]:
    print("Yes")
else:
    print("No")
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def powr(i, j, d):
    p = j
    ans = 1
    while p != 0:
        if p % 2 == 1:
            ans = (ans * i) % d
        i = i**2 % d
        p >>= 1
    return ans

def div(i, j):
    # 1/i mod(j)
    # calc i**(j-2) mod(j)
    return powr(i, j-2, j)

def make_comb(m, d):
    fac = [0] * (m+1)
    ifac = [0] * (m+1)
    # nCk
    fac[0] = 1
    ifac[0] = 1
    for i in range(m):
        fac[i+1] = (fac[i] * (i+1)) % d
        ifac[i+1] = (ifac[i] * div(i+1, d)) % d
    def comb(n, k):
        if n == 0 and k == 0:
            return 1
        if n < k or n < 0:
            return 0
        return (fac[n] * ifac[k] * ifac[n-k]) % d
    return comb

def main():
    n, a, b = list(map(int, input().strip().split()))
    d = 10**9+7
    comb = make_comb(10**6, d)
    ans = (powr(2, n, d) - 1 - comb(n, a) - comb(n, b)) % d
    if ans < 0:
        print(ans + d)
    else:
        print(ans)

    # print(comb(10, 2))
    # print(comb(5, 2))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def powr(i, j, d):
    p = j
    ans = 1
    while p != 0:
        if p % 2 == 1:
            ans = (ans * i) % d
        i = i**2 % d
        p >>= 1
    return ans

def div(i, j):
    # 1/i mod(j)
    # calc i**(j-2) mod(j)
    return powr(i, j-2, j)

# def make_comb(m, d):
#     fac = [0] * (m+1)
#     ifac = [0] * (m+1)
#     # nCk
#     fac[0] = 1
#     ifac[0] = 1
#     for i in range(m):
#         fac[i+1] = (fac[i] * (i+1)) % d
#         ifac[i+1] = (ifac[i] * div(i+1, d)) % d
#     def comb(n, k):
#         if n == 0 and k == 0:
#             return 1
#         if n < k or n < 0:
#             return 0
#         return (fac[n] * ifac[k] * ifac[n-k]) % d
#     return comb

def nck(n, k, d):
    ans = 1
    for i in range(n-(k-1), n+1):
        ans *= i % d
        ans %= d
    for i in range(1, k+1):
        ans *= div(i, d)
        ans %= d
    return ans % d

def main():
    n, a, b = list(map(int, input().strip().split()))
    d = 10**9+7
    # comb = make_comb(10**6, d)
    ans = (powr(2, n, d) - 1 - nck(n, a, d) - nck(n, b, d)) % d
    if ans < 0:
        print(ans + d)
    else:
        print(ans)

    # print(comb(10, 2))
    # print(comb(5, 2))


if __name__ == '__main__':
    main()
%%time
# B
a,b,k = list(map(int, input().split()))

def eat(a,b):
    a-= a%2
    b=int(b+a/2)
    a= int(a/2)
    return a,b

for i in range(k):
    if i%2==0:
        a,b = eat(a,b)
    else:
        b,a = eat(b,a)
print(a,b)

### FIXED CODE ###

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

def eat(a,b):
    a-= a%2
    b=int(b+a/2)
    a= int(a/2)
    return a,b

for i in range(k):
    if i%2==0:
        a,b = eat(a,b)
    else:
        b,a = eat(b,a)
print(a,b)
# -*- coding: utf-8 -*-

order = input().srtip()

ret = 700
for i in order:
    if i == 'o':
        ret += 100

print(ret)


### FIXED CODE ###

# -*- coding: utf-8 -*-

order = input()

ret = 700
for i in order:
    if i == 'o':
        ret += 100

print(ret)
s = input()
c = 0
n = len(s)
if n%2 == 0:  
	for i in range(n/2):
      if s[i]==s[-i]:
        c += 1
else:
  	for i in range((n-1)/2):
      if s[i]==s[-i]:
        c += 1
print(c)

### FIXED CODE ###

s = input()
c = 0
n = len(s)
if n%2 == 0:  
	for i in range(int(n/2)):
		if s[i]!=s[-(i+1)]:
			c = c + 1
else:
    for i in range(int((n+1)/2)):
        if s[i]!=s[-(i+1)]:
            c = c + 1
print(c)
n=int(input());t,a=map(int,input().split())
lis=list(map(int,input().split()));li,l=abs((t-lis[0]*0.006)-a),0
for i in range(1,n):if abs((t-lis[i]*0.006)-a) < li:li,l=abs((t-lis[i]*0.006)-a),i
print(l+1)

### FIXED CODE ###

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

li = abs((t-lis[0]*0.006)-a)
l = 0
for i in range(1,n):
    if abs((t-lis[i]*0.006)-a) < li:
        li=abs((t-lis[i]*0.006)-a)
        l=i
print(l+1)
a,b,c,d = map(int, input().split())

import math

def lcm(x, y):
    return int((x * y) / math.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = int(b/c) - int((a-1)/c)
sec = int(b/d) - int((a-1)/d)
rem = int(b/com) - int((a-1)/com)

result = total - (fir + sec -rem)
  
print(result)

### FIXED CODE ###

a,b,c,d = map(int, input().split())

import fractions

def lcm(x, y):
    return int((x * y) / fractions.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)
a,b,x=map(int,input().split())
n=0
moji=str(n)
y=len(moji)
money=a*n+b*y
while money<=x:
  n=n+1
  moji=str(n)
  y=len(moji)
  money=a*n+b*y
print(n-1)


### FIXED CODE ###

s=input()
li=["MON","TUE","WED","THU","FRI","SAT","SUN"]
if s=="SUN":
  print(7)
else:
  print(6-(li.index(s)))