Harryxun/stf_run huggingface dataset:
from collections import deque
n,k=[int(i) for i in input().split()]
D=deque()
h=[int(i) for i in input().split()]
for i in h:
    D.append(i)
    
maxnum=0
times=min(n,k)
for limit in range(times):
    for a in range(limit+1):
        get=[]
        Dcopy=D.copy()
        b=limit-a
        for i in range(a):
            get.append(Dcopy.popleft())
        for i in range(b):
            get.append(Dcopy.pop())
        get.sort(reverse=True)
#         print(get)
        for i in range(times-limit):
            if len(get)==0:
                break
            if get[-1]>=0:
                break
            get.pop()
        sumnum=0
        for i in get:
            sumnum+=i
        if sumnum>maxnum:
            maxnum=sumnum
print(maxnum)

### FIXED CODE ###

#デックをインポート
from collections import deque

#前準備
n,k=[int(i) for i in input().split()]

#デックを用意
D=deque()
h=[int(i) for i in input().split()]
for i in h:
    D.append(i)   
    
#答え
maxnum=0

#繰り返す単位
times=min(n,k)

#aとbの操作の合計のlimitを設定
for limit in range(times+1):
#     print(D)
    
    #aの操作を決定
    for a in range(limit+1):
        get=[]
        Dcopy=deque()
        for i in range(n):
            Dcopy.append(D[i])
        b=limit-a
        for i in range(a):
            get.append(Dcopy.popleft())
        for i in range(b):
            get.append(Dcopy.pop())
        get.sort(reverse=True)
#         print(get)
        for i in range(k-limit):
            if len(get)==0:
                break
            if get[-1]>=0:
                break
            get.pop()
        sumnum=0
        for i in get:
            sumnum+=i
        if sumnum>maxnum:
            maxnum=sumnum
            
#         print(a,b,Dcopy,get,sumnum)
print(maxnum)
import sys
import math
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())

    MOD = int(1e9) + 7

    kai = [1] * (N+1)
    for i in range(2, N+1):
        kai[i] = kai[i-1] * i
        kai[i] %= MOD

    MAX_PRIME = int(math.sqrt(M)) + 1
    primes = []
    is_prime = [True] * (MAX_PRIME+1)
    for i in range(2, MAX_PRIME+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_PRIME+1, i):
                is_prime[j] = False
    
    insu = []

    tmp = M
    max_count = 0
    for i in range(len(primes)):
        count = 0
        while tmp%primes[i] == 0:
            tmp //= primes[i]
            count += 1
        if count > 0:
            insu.append((primes[i], count))
            max_count = max(max_count, count)
    # print(insu)
    
    max_c = min(max_count, N)
    n_c = [1] * (max_c + 1)

    for i in range(1, max_c+1):
        n_c[i] = kai[N] * pow(kai[N-i], MOD-2, MOD) * pow(kai[i], MOD-2, MOD)

    ans = 1
    for p, c in insu:
        # print(p, c)
        tmp = 0
        for i in range(1, min(max_c, c)+1):
            tmp += n_c[i] * kai[c-1] * pow(kai[c-i], MOD-2, MOD) * pow(kai[i-1], MOD-2, MOD)
            tmp %= MOD
        if tmp > 0:
            ans *= tmp
            ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
input = sys.stdin.readline

def factorization(num):
    MAX_PRIME = int(math.sqrt(num)) + 1
    primes = []
    is_prime = [True] * (MAX_PRIME+1)
    for i in range(2, MAX_PRIME+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_PRIME+1, i):
                is_prime[j] = False
    insu = []
    tmp = num
    max_count = 0
    for i in range(len(primes)):
        count = 0
        while tmp%primes[i] == 0:
            tmp //= primes[i]
            count += 1
        if count > 0:
            insu.append((primes[i], count))
            max_count = max(max_count, count)
        if tmp == 1:
            break
    if tmp != 1:
        insu.append((tmp, 1))
    return insu, max_count

def main():
    N, M = map(int, input().split())

    MOD = int(1e9) + 7

    insu, max_count = factorization(M)
    
    kai = [1] * (max_count + N)
    for i in range(1, max_count + N):
        kai[i] = (kai[i-1] * i) % MOD
    
    ans = 1
    tmp = pow(kai[N-1], MOD-2, MOD)
    for prime, count in insu:
        ans *= kai[count + N - 1] * tmp * pow(kai[count], MOD-2, MOD)
        ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()
n,q=map(int,input().split())
tree = [set() for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    tree[a-1].add(b)
ans=[0]*n
def add_l(x):
    if not tree[x-1]:
        return
    else:
        for i in list(tree[x-1]):
            if not tree[i-1]:
                continue
            add_l(i)
            tree[x-1] |= (tree[i-1])
add_l(1)
#print(tree)

for i in range(q):
    
    p,x=map(int,input().split())
    ans[p-1]+=x
    for j in list(tree[p-1]):
        ans[j-1]+=x
print(*ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)
arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
x=input()
print(arr[x-1])

### FIXED CODE ###

arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
x=int(input())
print(arr[x-1])
x=input(vertical:)
y=input(horizontal:)
z=int(x)*int(y)
l=int(x)+int(y)
print(z l)

### FIXED CODE ###

z= input()
x, y = z.split()

m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))
import sys

readline = sys.stdin.buffer.readline


def main():
    N, K = map(int, readline().split())
    X = list(map(int, readline().split()))

    if N == 1:
        print(abs(X[0]))
        sys.exit()

    dm = X[K] - X[0]
    for i in range(0, N-K+1):
        d = X[i+K-1] - X[i] + min(abs(X[i+K-1]), abs(X[i]))
        if d < dm:
            dm = d

    print(dm)


main()


### FIXED CODE ###

import sys

readline = sys.stdin.buffer.readline


def main():
    N, K = map(int, readline().split())
    X = list(map(int, readline().split()))

    if N == 1:
        print(abs(X[0]))
        sys.exit()

    dm = 10**9
    for i in range(0, N-K+1):
        d = X[i+K-1] - X[i] + min(abs(X[i+K-1]), abs(X[i]))
        if d < dm:
            dm = d

    print(dm)


main()
g = Graph()
N,M = list(map(int, input().split()))
INF = 10**9+7
A = [[INF if i!=j else 0 for i in range(N)] for j in range(N)]
S=[]
E=[]
W=[]

for i in range(M):
    s,e,w=list(map(int,input().split()))
    g.add_edge(s-1, e-1, w)
    g.add_edge(e-1, s-1, w)
    S.append(s-1)
    E.append(e-1)
    W.append(w)

for i in range(N):
    d = Dijkstra(g, i)
    for j in range(i+1,N):
        dist = d.shortest_distance(j)
        A[i][j] = dist
        A[j][i] = dist
        
ans=M
for i in range(M):
    shortest = False
    for j in range(N):
        if A[j][S[i]] + W[i] == A[j][E[i]]:
            shortest = True
    if shortest:
        ans-=1

print(ans)

### FIXED CODE ###

from collections import defaultdict
from heapq import heappop, heappush

class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]

g = Graph()
N,M = list(map(int, input().split()))
INF = 10**9+7
A = [[INF if i!=j else 0 for i in range(N)] for j in range(N)]
S=[]
E=[]
W=[]

for i in range(M):
    s,e,w=list(map(int,input().split()))
    g.add_edge(s-1, e-1, w)
    g.add_edge(e-1, s-1, w)
    S.append(s-1)
    E.append(e-1)
    W.append(w)

for i in range(N):
    d = Dijkstra(g, i)
    for j in range(i+1,N):
        dist = d.shortest_distance(j)
        A[i][j] = dist
        A[j][i] = dist
        
ans=M
for i in range(M):
    shortest = False
    for j in range(N):
        if A[j][S[i]] + W[i] == A[j][E[i]]:
            shortest = True
    if shortest:
        ans-=1

print(ans)
N=int(input())
W=[]
for i in range(N):
  W.append(input())
for i in range(N-1):
  if W[i][-1] != W[i+1][0]:
    print('No')
    return
  for j in range(i+1, N):
    if W[i]==W[j]:
      print('No')
      return
print('Yes')

### FIXED CODE ###

N=int(input())
W=[]
for i in range(N):
  W.append(input())
for i in range(N-1):
  if W[i][-1] != W[i+1][0]:
    print('No')
    exit()
  for j in range(i+1, N):
    if W[i]==W[j]:
      print('No')
      exit()
print('Yes')
from collections import deque

def Topologicalsort():
    for i in xrange(v):
        if indeg[i]==0 and color[i]==0:
            bfs(i)

def bfs(s):
    color[s]=2
    q.append(s)
    while len(q)>0:
        i=q.popleft()
        ans.append(i)
        for j in xrange(v):
            if m[i][j]!=-1 and color[j]==0 :
                indeg[j]-=1
                if indeg[j]==0:
                    q.append(m[i][j])
                    color[j]=1

v,e=map(int,raw_input().split())
m=[[-1]*v for i in xrange(v)]
indeg=[0]*v
color=[0]*v
start=[]
ans=deque()
q=deque()
for i in xrange(v):
    s,t=map(int,raw_input().split())
    m[s][t]=t
    indeg[t]+=1
Topologicalsort()
for i in ans:
    print(i)

### FIXED CODE ###

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

from collections import deque

def Topologicalsort(n):     #n??????????????°
    start=deque()
    for i in xrange(n):
        if indeg[i]==0 :
            start.append(i)
    while len(start)>0:
        i=start.popleft()
        ans.append(i)
        for j in g[i]:
            indeg[j]-=1
            if indeg[j]==0:
                start.append(j)
    return ans

v,e=map(int,raw_input().split())
g=[[]for i in xrange(v)]
indeg=[0]*v
ans=[]
for i in xrange(e):
    s,t=map(int,raw_input().split())
    g[s].append(t)
    indeg[t]+=1
    
ans=Topologicalsort(v)
for i in ans:
    print(i)
import sys
S = input()
S_list = list(S)
flag = 1
S_pick = []

if len(S) < 2:
    print(0)
    sys.exit()

while flag:
    if len(S_list) == 0:
        break
    tmp = S_list[0]
    count = 0
    for i in range(1, len(S_list)):
        if S_list[i] == tmp and i == len(S_list)-1:
            break
            
        elif S_list[i] == tmp:
            tmp = S_list[i]
        else:
            S_pick.append(i-1)
            S_pick.append(i)
            tmp = S_list[i+1]
    for i in range(len(S_pick)-1, -1, -1):
        S_list.pop(S_pick[i])
    if len(S_pick) == 0:
        flag = 0
    S_pick = []
    
print(len(S)-len(S_list))

### FIXED CODE ###

S = input()
S_list = list(S)

count0 = S_list.count("0")
count1 = S_list.count("1")

print(len(S_list) - abs(count0-count1))
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

SS = [[0]*10**7 for _ in range(N)]
for i, csf in enu(CSF):
    c, s, f = csf
    for j in range(s, 10**6, f):
        SS[i][j] = 1
# print(SS[0][:20])
# print(SS[1][:20])

for i in range(N-1):
    st = i
    sec = 0
    while st < N-1:
        # print('st', st, 'sec', sec)
        # print('st', st)
        if SS[st][sec] == 1:
            sec += CSF[st][0]
            st += 1
        else:
            sec += 1
    print(sec)
print(0)

### FIXED CODE ###

# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

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

for i in range(N - 1):
    c, s, f = CSF[i]
    time = s + c
    for csfj in CSF[i + 1 :]:
        c, s, f = csfj
        if time < s:
            time = s
        else:
            time = f * ((time + f - 1) // f)
        time += c
    print(time)

print(0)
n=int(input())
button=[int(input()) for i in range(n)]
temp=1
ans=1
while button[temp-1] not in check:
  temp=button[temp-1]
  ans+=1
  if button[temp-1]==2:
    print(ans)
    break
  elif ans>=n+1:
    print(-1)
    break


### FIXED CODE ###

n=int(input())
button=[int(input()) for i in range(n)]
temp=1
ans=0
while True:
  temp=button[temp-1]
  ans+=1
  if temp==2:
    print(ans)
    break
  elif ans>=n:
    print(-1)
    break
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [[-1] + [int(x)-1 for x in row.split()][::-1] for row in sys.stdin.readlines()]

A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        cand1.add(A[n][-1])
    return len(can_use),cand1

answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x,cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break

print(answer)



### FIXED CODE ###

N = int(input())
es = [[] for i in range(N)]
cand = set()
for i in range(N):
  es[i] = [int(i)-1 for i in input().split()][::-1]
def check(i):
  if es[i]==[]:
    return
  j = es[i][-1]
  if es[j]==[]:
    return
  if es[j][-1]==i:
    cand.add(i)
    cand.add(j)

for i in range(N):
  check(i)
day = 0
while cand:
  day += 1
  precand = cand.copy()
  cand = set()
  for i in precand:
    x = es[i].pop()
  for i in precand:
    check(i)
for i in range(N):
  if len(es[i])!=0:
    print(-1)
    break
else:
  print(day)
n = int(input())
for i in range(n+1):
    if i**2 > n:
        print((i-1)**2)
        exit()

### FIXED CODE ###

S = str(input())
s = str(input())
if S[0] == s[2] and S[1] == s[1] and S[2] == s[0]:
    print("YES")
else:
    print("NO")
l = list(range(10001))
l = list(map(str, l))
print(l)
c = 0
N, K = map(int, input().split())
ld = list(map(str, input().split()))
del l[:N]
while True:
    if any(x in l[c] for x in ld):
        c += 1
    else:
        break
print(int(l[c]))


### FIXED CODE ###

c = 0
f = True
N, K = map(int, input().split())
ld = list(map(str, input().split()))
while f:
    i = 0
    N_str = str(N)
    for i in range(K):
        # print(i)
        if ld[i] in N_str:
            N += 1
            break
        elif i == K-1:
            f = False
print(N)
from collections import deque
import numpy as np

def bfs(sy, sx):
    #max = 0
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    que = deque([])
    que.append((sy, sx))
    d[sy][sx] = 0

    while que:
        p = que.popleft()

        for i in range(4):
            nx = p[1] + dx[i]
            ny = p[0] + dy[i]
            #a = temp[ny][nx]
            if 0<=nx<W and 0<=ny<H and maze[ny][nx]!="#":
                #que.append((nx))
                temp[ny][nx] = d[p[0]][p[1]] + 1
                a = temp[ny][nx]
                #d[ny][nx] = d[p[0]][p[1]] + 1
                if a < d[ny][nx]:
                    que.append((ny, nx))
                    d[ny][nx] = a
                    #if max < d[ny][nx]:
                        #max = d[ny][nx]

    return np.max(np.array(d))

H, W = map(int, input().split())
d = [[float("inf")]*W for i in range(H)]
temp = [[float("inf")]*W for i in range(H)]
#maze = [list(input()) for i in range(H)]
slist = []
for i in range(H):
    for j in range(W):
        maze[i][j] = input()
        if maze[i][j]=="#":
            slist.append((i, j))



for i in slist:
    s = bfs(i[0], i[1])

print(s)


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

# '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            black_cells.append((h, w))
            dist[h][w] = 0

def bfs(black_cells, dist):
    """
    BFSを用いて、全マス目を黒くする回数を求める

    Args:
        black_cells: 「開始時の黒マス」の座標が入ったキュー（複数座標あり）
        dist: 「開始時の黒マス」からの距離の入ったリスト  [[-1, -1, 0], ...]
        　　　（白マスの初期値は0）

    Returns:
        g: 操作を繰り返した数
    """
    d = 0
    while black_cells:
        # キューとして使うのでpop()ではなくpopleft()
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:  # セルが白('.')であるのと同義
                dist[new_h][new_w] = d+1
                black_cells.append((new_h, new_w))
    return d

d = bfs(black_cells, dist)
print(d)
a,b = map(int,input().split())
if a>=13:
	print(b)
elif a<=5:
	print(0)
else:
	print(b/2) a,b = map(int,input().split())
if a>=13:
	print(b)
elif a<=5:
	print('a')
else:
	print(b/2)

### FIXED CODE ###

a,b=map(int,input().split())
if a<=5:
   print(0)
elif a<=12:
   print(b//2)
else:
   print(b)
N = int(inout())
L = input().split()
flag = 0

for i in range(N):
  L[i] = int(L[i])
  total += L[i]

for i in range(N):
  if L[i]*2 >= total:
    print("No")
    flag = 1
    break

if flag == 0:
  print("Yes")


### FIXED CODE ###

N = int(input())
L = input().split()
max = 0
count = 0

for i in range(N):
  count += int(L[i])
  if max < int(L[i]):
    max = int(L[i])
    
if count > 2*max:
  print("Yes")
else:
  print("No")
import re

a=input()
b=input()

if len(b)-len(a)==1:
    if re.search(a,b) is None:
        print("No")
    else:
        print("Yes")
else
    print("No")


### FIXED CODE ###

import re

a=input()
b=input()

if len(b)-len(a)==1:
    if re.search("^"+a,b) is None:
        print("No")
    else:
        print("Yes")
else:
    print("No")
while True:
  for i in range(1,31):
    n=int(input())
    if i%7==0:
      print('{}'.format('thu'))
    elif i%7==1:
      print('{}'.format('fri'))
    elif i%7==2:
      print('{}'.format('sat'))
    elif i%7==3:
      print('{}'.format('san'))
    elif i%7==4:
      print('{}'.format('mon'))
    elif i%7==5:
      print('{}'.format('tue'))  
    else:
      print('{}'.format('wed'))


### FIXED CODE ###

x=int(input())
week=["thu","fri","sat","sun","mon","tue","wed"]
print(week[x%7])
# summer vacations, number of assignments
N, M = list(map(int, input().split()))
# each entry in A represents number of days to do the assignment
A = list(map(int, input().split()))

number_of_days_required = sum(A)
maximum_hangout_days = N - number_of_days_required
if maximum_hangout_days >= 0:
  print(maximum_hangout_days)
  else:
    print(-1)

### FIXED CODE ###

# summer vacations, number of assignments
N, M = list(map(int, input().split()))
# each entry in A represents number of days to do the assignment
A = list(map(int, input().split()))

number_of_days_required = sum(A)
maximum_hangout_days = N - number_of_days_required
if maximum_hangout_days >= 0:
    print(maximum_hangout_days)
else:
    print(-1)
A, B, K = map(int, input().split())

for i in range(K):
	if A == 0 or B == 0:
		break
    if A % 2 == 1:
        A -= 1
    A /= 2
    A, B = B + A, A

print(int(A), int(B))

### FIXED CODE ###

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

for i in range(K):
    if A % 2 == 1:
        A -= 1
    A /= 2
    A, B = B + A, A

if K % 2 == 1:
    A, B = B, A
print(int(A), int(B))
n,a,b=map(int, input().split())

def cmb(n, r, mod):
    if (r<0 or r>n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 
N = 2*10**5
g1 = [1, 1] 
g2 = [1, 1] 
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def pos(x, n, m):
    res = pos(x*x%m, n//2, m)
    if n%2 == 1:
        res = res*x%m
    return res
    
if n==2:
    print(0)
else:
    ans=pos(2,n,mod)-1-cmb(n,a,mod)-cmb(n,b,mod)
    print(ans%mod)

### FIXED CODE ###

n,a,b=map(int, input().split())
 
def comb(n, r,MOD):
    p, q = 1, 1
    for i in range(r):
        p = p * (n-i) % MOD
        q = q * (i+1) % MOD
    return p * pow(q, MOD-2, MOD) % MOD

mod=10**9+7
    
A=comb(n,a,mod)
B=comb(n,b,mod)  
C=pow(2,n,mod)

if n==2:
    print(0)
else:
    print((C-1-A-B)%mod)
#coding :utf-8

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

ans=sum(([1]*A+[0]*B+[-1]*C)[:K])

print(ans)

### FIXED CODE ###

#coding :utf-8
A,B,C,K=map(int,input().split())
cnt=0
if K-A > 0:
  cnt=A
  if K-A-B >0:
    cnt=cnt-(K-A-B)
    print(cnt)
  else:
    print(cnt)
else:
  print(K)
n=int(input())
l=[]
for i in range(1,n**(1/2)//1+1):
  if n%i==0:
    l.append(n//i+i)
  if len(l)==3:break
print(min(l)-2)

### FIXED CODE ###

n=int(input())
l=set()
for i in range(1,int(n**(1/2))+1):
  if n%i==0:
    l.add(n//i+i)
print(min(list(l))-2)
s = input()
t = input()
ans = ''
for i in range(len(s)-len(t), -1, -1):
    s_tmp = s[i:i+len(t)]
    flag = 0
    for j in range(len(t)):
        if s_tmp[j] == '?':
            s_tmp = t[:j+1] + s_tmp[j+1:]
        elif s_tmp[j] != t[j]:
            flag = 1
            break
    if flag == 0:
        ans = s[:i] + t + s[i+len(t):]
        break
if flag == 0:
    for i in range(len(ans)):
        if ans[i] == '?':
            ans = ans[:i] + 'a' + ans[i+1:]
    print(ans)
else:
    print('UNRESTORABLE')


### FIXED CODE ###

s = input()
t = input()

flag = 0
count = 0
new = ''
l = []
for i in range(len(s)):
    if s[i] == '?' or s[i] in t:
        if count == 0:
            start = i
        count += 1
    else:
        if count >= len(t):
            for j in range(count-len(t)+1):
                check = 0
                for k in range(len(t)):
                    if s[start+j+k] != t[k] and s[start+j+k] != '?':
                        check = 1
                        break
                if check == 0:
                    new = s[:start+j] + t + s[start+len(t)+j:]
                    l.append(new)
                    flag = 1
        count = 0

if count >= len(t):
    for j in range(count-len(t)+1):
        check = 0
        for k in range(len(t)):
            if s[start+j+k] != t[k] and s[start+j+k] != '?':
                check = 1
                break
        if check == 0:
            new = s[:start+j] + t + s[start+len(t)+j:]
            l.append(new)
            flag = 1

if flag == 0:
    print('UNRESTORABLE')
else:
    ans = []
    for n in l:
        for i in range(len(n)):
            if n[i] == '?':
                n = n[:i] + 'a' + n[i+1:]
        ans.append(n)
    print(sorted(ans)[0])