Harryxun/stf_run huggingface dataset:
N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]
n = 0

for i in range(N):
    n = 0
    while len(s[i]) > len(a) and n < len(a):
        if a[n] == s[i][n]:
            n += 1
        else:
            if ord(a[n]) > ord(s[i][n]):
                s[i].pop(n)
                n -= 1
            else:
                a.pop(n)
                n -= 1
    if a[n-1] == s[i][n-1]:
        continue
    else:
        a.pop(-1)

print(''.join(a))


### FIXED CODE ###

N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]

for i in range(N):
    n = 0
    while a != s[i] and n < len(a) and n < len(s[i]):
        if a[n] == s[i][n]:
            n += 1
        else:
            if a[n] > s[i][n]:
                s[i].pop(n)
            else:
                a.pop(n)
    if len(a) > len(s[i]):
        a = s[i]

print(''.join(a))
def mod(n):
    return n % 2019

import itertools
import numpy as np
import operator as op
L, R = map(int, input().split())

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))



### FIXED CODE ###

L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        for i in range(H):
            del AllArea[i][:(CoordinateList[n][0])]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].insert(0,"B")
        #print(AllArea)
    elif CoordinateList[n][2] == 2:
        for i in range(H):
            del AllArea[i][(CoordinateList[n][0]):]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].append("B")

        #print(AllArea)

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        del AllArea[changeY:]
        for changeRaw in range(changeY):
            AllArea.append(rawBlack)
        #print(AllArea)

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        del AllArea[:changeY]
        for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
        #print(AllArea)

# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

#print(AllArea)
print(AreaWhite)



### FIXED CODE ###

W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        if CoordinateList[n][0] == 0:
             pass
        else:
            for i in range(H):
                del AllArea[i][:(CoordinateList[n][0])]
                for numX in range(CoordinateList[n][0]):
                    AllArea[i].insert(0,"B")

    elif CoordinateList[n][2] == 2:
        if CoordinateList[n][0] == 0:
            print(0)
            exit()
        else:
            for i in range(H):
                del AllArea[i][(CoordinateList[n][0]):]
                for numX in range(CoordinateList[n][0]):
                    AllArea[i].append("B")

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        if changeY == 0:
            print(0)
            exit()
        else:
            del AllArea[changeY:]
            
            for changeRaw in range(int(CoordinateList[n][1])):
                AllArea.append(rawBlack)
            

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        if changeY == 0:
            pass
        else:
            del AllArea[:changeY]
            for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
            
# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

print(AreaWhite)
import sys

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for e in sys.stdin:
  c.append(list(map(int, e.split())))

ans = min(a) + min(b)

for i in range(len(c)):
  temp_val = a[c[i][0]] + b[c[i][1]] - c[i][2]
  if temp_val < ans:
    ans = temp_val

print(ans)

### FIXED CODE ###

import sys

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for e in sys.stdin:
  c.append(list(map(int, e.split())))

ans = min(a) + min(b)

for i in range(len(c)):
  temp_val = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
  if temp_val < ans:
    ans = temp_val

print(ans)
a1, a2, a3 = map(int, input().split(' '))
    if (a1 + a2 + a3) >=22:
        print("bust")
    else:
        print("win")

### FIXED CODE ###


if __name__ == '__main__':
    a1, a2, a3 = map(int, input().split(' '))
    if (a1 + a2 + a3) >=22:
        print("bust")
    else:
        print("win")
n, m = map(int, input().split())

if n / m == 1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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

if n == m:
    print("Yes")
else:
    print("No")
n = int(input())
A = [int(input()) for _ in range(n)]
used = {1}
pos = 1
count = 0
for _ in range(n):
  pos = A[pos - 1]
  count += 1
  if pos in used:
    print(-1)
    break
  used.append(pos)
  if pos == 2:
    print(count)
    break


### FIXED CODE ###

n = int(input())
A = [int(input()) for _ in range(n)]
used = {1}
pos = 1
count = 0
for _ in range(n):
  pos = A[pos - 1]
  count += 1
  if pos in used:
    print(-1)
    break
  used.add(pos)
  if pos == 2:
    print(count)
    break
a,b = map(int, input().split())
print([a+b, a-b, a×b])

### FIXED CODE ###

a,b = map(int, input().split())
print(max([a+b, a-b, a*b]))
a = input()
print("{}".format(a*a*a))


### FIXED CODE ###

a = int(input())
a = a*a*a
print(a)
K = input()

if K == 1:
    print("ACL"):
elif K == 2:
    print("ACLACL"):
elif K == 3:
    print("ACLACLACL"):
elif K == 4:
    print("ACLACLACLACL"):
else:
    print("ACLACLACLACLACL"):


### FIXED CODE ###

K = int(input())

if K == 1:
    print("ACL")
elif K == 2:
    print("ACLACL")
elif K == 3:
    print("ACLACLACL")
elif K == 4:
    print("ACLACLACLACL")
else:
    print("ACLACLACLACLACL")
import numpy as np

read = sys.stdin.buffer.read

n = int(input())
p = np.array(read().split(), dtype=np.int64).reshape(-1,2)

ans = np.sum((p[:,1]-p[:,0])+1)
print(ans)

### FIXED CODE ###

import sys
import numpy as np

read = sys.stdin.read

n = int(input())
p = np.array(read().split(), dtype=np.int64).reshape(-1,2)

ans = np.sum((p[:,1]-p[:,0])+1)
print(ans)
a,op,b = input().split("")
if(op=='+'):
    print(int(a)+int(b))
else:
    print(int(a)-int(b))

### FIXED CODE ###

print eval(raw_input())
# print eval(raw_input())
x=int(input())
print x**3


### FIXED CODE ###

x=int(input())
print (x**3)
N,M=map(int,input().split())
A=[int(i) for i in input().split()]
Match=[0,2,5,5,4,5,6,3,7,6]
A.sort(reverse=True)
dp=[0]*(N+1)
dp[0]=1
for i in range(1,N+1):
  for a in A:
    if i>=Match[a]:
      dp[i]|=dp[i-Match[a]]<<1

for k in range(N)[::-1]:
  if dp[N]&(1<<k):
    S=k
    break
ans=[]
m=0
for k in range(S):
  if dp[N-Match[A[m]]]&(1<<(S-k-1)) and N-Match[A[m]]>=0:
    ans.append(str(A[m]))
    N-=Match[A[m]]
  else:
    for l in range(m+1,len(A)):
      if dp[N-Match[A[l]]]&(1<<(S-k-1)) and N-Match[A[l]]>=0:
        m=l
        ans.append(str(A[m]))
        N-=Match[A[m]]
        break
print("".join(ans))


### FIXED CODE ###

N,M=map(int,input().split())
A=[int(i) for i in input().split()]
Match=[0,2,5,5,4,5,6,3,7,6]
A.sort(reverse=True)
dp=[0]*(N+1)
dp[0]=1
for i in range(1,N+1):
  for a in A:
    if i>=Match[a]:
      dp[i]|=dp[i-Match[a]]<<1

for k in range(N)[::-1]:
  if dp[N]&(1<<k):
    S=k
    break
ans=[]
m=0
for k in range(S):
  if N-Match[A[m]]>=0:
    if dp[N-Match[A[m]]]&(1<<(S-k-1)):
      ans.append(str(A[m]))
      N-=Match[A[m]]
    else:
      for l in range(m+1,len(A)):
        if N-Match[A[l]]>=0:
          if dp[N-Match[A[l]]]&(1<<(S-k-1)):
            m=l
            ans.append(str(A[m]))
            N-=Match[A[m]]
            break
  else:
    for l in range(m+1,len(A)):
      if N-Match[A[l]]>=0:
        if dp[N-Match[A[l]]]&(1<<(S-k-1)):
          m=l
          ans.append(str(A[m]))
          N-=Match[A[m]]
          break
print("".join(ans))
a,b=map(int.input().split())
print(a-1*b-1)

### FIXED CODE ###

a,b=map(int,input().split());print(a*b-a-b+1)
n=int(raw_input())
a=map(int, raw_input().split())

print ' '.join(map(str, a.reverse()))

### FIXED CODE ###

n = int(raw_input())




a = map(int, raw_input().split())
a.reverse()
print ' '.join(map(str, a))
H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(input().split())
  a.append(b)
for i in range(2*H):
  for j in range(W):
    print(a[i//2][j],end="")
  print('')

### FIXED CODE ###

H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(input())
  a.append(b)
for i in range(2*H):
  for j in range(W):
    if j != W - 1:
      print(a[i//2][j],end="")
    else:
      print(a[i//2][j])
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
ans=[]
n=int(raw_input())
for _ in range(n):
    (a,b)=map(str, raw_input().split())
    if a=='insert': ans.insert(0,b)
    elif a=='deleteFirst': del ans[0]
    elif a=='deleteLast': del ans[-1]
    else: ans.remove(b)
print ' '.join(ans)

### FIXED CODE ###

import sys
import collections
n=int(raw_input())
ans=collections.deque()
while n:
    n-=1
    s=sys.stdin.readline().rstrip().split(' ')
    if s[0][0]=='i':
        ans.appendleft(s[1])
    elif s[0][-3]=='r':
        ans.popleft()
    elif s[0][-3]=='a':
        ans.pop()
    else:
        try:
            ans.remove(s[1])
        except:
            pass
sys.stdout.write(' '.join(ans))
print
A = map(int(input()))
B = map(int(input()))
C = map(int(input()))
K = map(int(input()))
if K <= A + B:
  print(K)
else:
  print(A * 2 + B - K)

### FIXED CODE ###

import math
A, B, C, K = list(map(int, input().split()))
if K <= A:
  print(K)
if A < K <= A + B:
  print(A)
if A + B < K <= A + B + C:
  print(A * 2 + B - K)
print str(x^3)

### FIXED CODE ###

x = input()
print str(x*x*x)
import numpy as np

H, W = map(int, raw_input().split())
S_list = list()
for i in range(H):
    S_list.append(raw_input())


X_mat = np.zeros((H, W), dtype='int')
S_mat_extend = np.zeros((H+2, W+2), dtype='int')
# input
for h in range(H):
    for w in range(W):
        if S_list[h][w] == 'X':
            X_mat[h, w] += 1

# make graph
G = dict()
def add_node(s, Graph=G):
    Graph[s] = {'edges':dict()}
    
def add_edge(s, t, weight=1, Graph=G):
    Graph[s]['edges'][t] = weight

def max_flow(s, t, Graph=G):
    G_ = Graph
    flow = 0
    
    while True:
        # initialize
        for v in G_.keys():
            G_[v]['reach'] = -1
            G_[v]['path'] = ''
        G_[s]['reach'] = 1
        # bfs
        ques = [s]
        while len(ques) > 0:
            v = ques.pop()
            for d in G_[v]['edges'].keys():
                if G_[v]['edges'][d] > 0 and G_[d]['reach'] == -1:
                    # update
                    G_[d]['reach'] = 1
                    G_[d]['path'] = v
                    ques.append(d)
                    if d == t:
                        flow += 1
                        break

        if G_[t]['path'] != '':
            y = t
            while True:
                x = G_[y]['path']
                G_[x]['edges'][y] -= 1
                if x not in Graph[y]['edges'].keys():
                    add_edge(y, x, weight=0, Graph=G_)
                G_[y]['edges'][x] += 1
                if x == s:
                    break
                else:
                    y = x
        else:
            break
    
    return flow


# src:sheeps
# dst:outer
add_node('src')
add_node('dst')

# grid
for i in range(H):
    for j in range(W):
        add_node(str([i, j]) + '-src')
        add_node(str([i, j]) + '-dst')
        add_edge(str([i, j]) + '-dst', str([i, j]) + '-src')
        if X_mat[i, j] == 1:
            add_edge('src', str([i, j]) + '-dst', 100000)
            add_edge(str([i, j]) + '-dst', str([i, j]) + '-src', 100000)
        if i > 0:
            add_edge(str([i, j]) + '-src', str([i-1, j]) + '-dst')
        if i < H-1:
            add_edge(str([i, j]) + '-src', str([i+1, j]) + '-dst')
        if j > 0:
            add_edge(str([i, j]) + '-src', str([i, j-1]) + '-dst')
        if j < W-1:
            add_edge(str([i, j]) + '-src', str([i, j+1]) + '-dst')
        if i == 0 or j == 0 or i == H-1 or j == W-1:
            add_edge(str([i, j]) + '-src', 'dst', 100000)

res = 0
# find -1
if X_mat[0,:].sum() + X_mat[H-1,:].sum() + X_mat[:,0].sum() + X_mat[:,W-1].sum() > 0:
    res = -1
else:
    res = max_flow('src', 'dst')


print res

### FIXED CODE ###

N, A, B = map(int, raw_input().split())
t_list = list()
for i in range(N):
    t_list.append(int(raw_input()))

res = len(t_list) - len([t for t in t_list if t >= A and t < B])

print res
result=[]; a,b,n = list(map(int,input().split()))
for x in range(n+1):
  result.append((math.floor(a*x/b))-(a*math.floor(x/b)))
else:
  print(max(result))

### FIXED CODE ###

a, b, n = map(int,input().split())
x = min(n,b-1)
print(int(a*(x%b) / b))
def Solve(acts,first,second,third,index):
    if index == len(acts):
        return 0
    
    if first:
        val1 =  acts[index][0]+Solve(acts,False,True,True,index+1)
    else:
        val1 = 0
    if second:
        val2 = acts[index][1]+Solve(acts,True,False,True,index+1)
    else:
        val2 = 0
    if third:
        val3 =  acts[index][2]+Solve(acts,True,True,False,index+1)
    else:
        val3 = 0

    return max(val1,val2,val3)

def main():
    n = int(input())
    acts = []
    for i in range(n):
        a,b,c = map(int,input().split())
        acts.append((a,b,c))

    dp = [[0 for x in range(3)] for y in range(n)]
    dp[0][0] = acts[0][0]
    dp[0][1] = acts[0][1]
    dp[0][2] = acts[0][2]

    for i in range(1,n):
        dp[i][0] = dp[i-1][0]+max(acts[i][1],acts[i][2])
        dp[i][1] = dp[i-1][1]+max(acts[i][0],acts[i][2])
        dp[i][2] = dp[i-1][2]+max(acts[i][0],acts[i][1])

    #print(max(dp[-1]))
    #print(dp)

    print(Solve(acts,True,True,True,0))

main()


### FIXED CODE ###

def main():
    n = int(input())
    dp = [[0 for i in range(3)] for j in range(n)]

    for i in range(n):
        a,b,c = map(int,input().split())
        if i == 0:
            dp[i][0] = a
            dp[i][1] = b
            dp[i][2] = c
        else:
            dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a
            dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b
            dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c


    print(max(dp[-1]))


main()
import math

def myfactorial(n):
  return math.factorial(n)

def combinations_count(n, r):
  return (myfactorial(n) // (myfactorial(n - r) * myfactorial(r))) % 1000000007

n, k = map(int, input().split())
for i in range(1, k+1):
  print(combinations_count(k-1, i-1) * combinations_count(n-k+1, i) % 1000000007) 

### FIXED CODE ###

import math

def myfactorial(n):
  return math.factorial(n)

def combinations_count(n, r):
  return (myfactorial(n) // (myfactorial(n - r) * myfactorial(r))) % 1000000007

n, k = map(int, input().split())
for i in range(1, k+1):
  if n-k+1 < i:
    print(0)
  else:
    print(combinations_count(k-1, i-1) * combinations_count(n-k+1, i) % 1000000007)
from collections import deque
n,m,k=map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a = deque(a)
b = deque(b)
ans = 0
while(n!=m):
    if(n>m):
        b.append(10**9+1)
        m += 1
    else:
        a.append(10**9+1)
        n +=1
while(k>0):
    if(a[0]>b[0]):
        if(k >= b[0]): 
            k -= b.popleft()
            ans +=1
        else:
            break
    else:
        if(k >= a[0]):
            k -= a.popleft()
            ans += 1
        else:
            break
print(ans)

### FIXED CODE ###

import sys
n,m,k=map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

ans = 1
c = [0]
d = [0]
for i in range(1,n+1):
    c.append(c[i-1] + a[i-1])
    if(c[i] > k):
        c.pop()
        break
for i in range(1,m+1):
    d.append(d[i-1] + b[i-1])
    if(d[i] > k):
        d.pop()
        break


leng = len(c)
lend = len(d)
ans = leng - 1
temp = 0
for i in range(leng):
    p = c[leng-i-1]
    t = temp
    while(t < lend and p+d[t] <= k):
        t += 1
        if(t==lend):
            print(max(ans,leng-i-2+t))
            sys.exit()
    ans = max(ans,leng-i-2+t)
    temp = t

print(ans)
n,k,s=map(int,input().split())
if s==10**9:
  print(*[s]*k,*[1]*(n-k))
else:
  print(*[s]*k,*[10**9]*(n-k))

### FIXED CODE ###

n,ko,aim=map(int,input().split())
l=[aim for i in range(ko)]
d=10**9-1 if aim==10**9 else 10**9
f=[d for i in range(n-ko)]
ll=l+f
print(*ll,sep=" ")
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n = int(input())
x = list(map(int, input().split()))

print(gcd_list(x))

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))

hp = max(l)

l.sort()

while hp > 1 and len(l) != 1:
    a = l[0]
    for i in range(1, len(l)):
        l[i] %= a
    l.sort()
    while l[0] == 0:
        l.remove(0)
    if l[0] < hp:
        hp = l[0]

print(hp)
d, t, s = list(map(int, input()))

min = d / s

if min <= t:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

d, t, s = list(map(int, input().split(" ")))

min = d / s

if min <= t:
  print("Yes")
else:
  print("No")
import bisect

def number(num):
  #0bのぶんを引きます
  number_len = len(num)-2
  #numと同じ桁数で各桁が全て1である数を求めます。
  f ＝ 2**number_len - 1
  #排他的論理和をとって1を足したものを返します
  return (num^f)+1

n=int(input())
line=list(map(int,input().split))

count=0

while len(line)>0:
  #最後の数を取ってくる(最後尾なのでO(1)で済む)
  k=line.pop()
  #整数でないならその数は存在しないと同義なので処理を行わない
  if int(k) != k:
    continue
  x=number(k)
  #もしlineの最大値よりxが大きければ条件を満たすxは存在しないので処理を行わない
  if x>line[-1]:
    continue
  #その数が存在するならば、その数をlistから消去して、カウントする
  if line[bisect.bisect_left(line,x)]==x:
    #0.5を足すことでremoveの代わりとする
    line[bisect.bisect_left(line,x)] += 0.5
    count+=1

print(count)

### FIXED CODE ###

import bisect
def reversed_num(num):
  num_len=len(bin(num))-2
  f=2**num_len-1
  return num^f
n=int(input())
number=list(map(int,input().split()))
number.sort()
count=0
while len(number)>0:
  k=number.pop()
  if len(number)==0:
    break
  if k==int(k):
    x=reversed_num(k)+1
    y=bisect.bisect_left(number,x)
    if x>number[-1]:
      y-=1
    if number[y] ==x:
      number[y]-=0.5
      count+=1
print(count)
a, b, c, k = map(int,input().split())
li = [1]*a
li += [0]*b
li += [-1]*c
print(sum(li[:k]))

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys

def main():
    A, B, C, K = map(int, input().split())
    if K<=A:
        print(K)
    elif K<=(A+B):
        print(A)
    elif K<=(A+B+C):
        print(A-(K-A-B))
    else:
        print(A-C)

if __name__ == '__main__':
    main()
n,r = map(int,input().split())

if n >=10:
  print(r)
else:
  print(r+100×(10−n))

### FIXED CODE ###

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

if n >=10:
  print(r)
else:
  print(r+100*(10-n))
import math
A, B, H, M = = map(int, open(0).split())

K = abs(math.pi*M/30 - math.pi*H/6)

print(math.sqrt(A**2+B**2 - 2*A*B*math.cos(K)))


### FIXED CODE ###

import math
A, B, H, M = map(int, input().split())


arg_b = math.pi * float(M) / 30
arg_a = (math.pi / 6) * (float(H) + float(M)/60) 
K = abs(arg_b - arg_a)
C = math.sqrt(A*A+B*B - 2*A*B*math.cos(K))
print(C)
sorted([int(x) for x in input().split(()])

### FIXED CODE ###

list=sorted([int(x) for x in input().split()])
print(str(list[0])+" "+str(list[1])+" "+str(list[2]))
import collections

S=input()
N=len(S)
D=collections.deque([])

for i in range(N):
  if S[i]=="B":
    D.pop()
  else:
    D.append(S[i])
    
print("".join(list(D)))

### FIXED CODE ###

import collections

S=input()
N=len(S)
D=collections.deque([])

for i in range(N):
  if S[i]=="B":
    if len(D):
      D.pop()
  else:
    D.append(S[i])
print("".join(list(D)))
s = input()
t = input()
num_s = len(s)
num_t = len(t)
idx_t = []

def match(s,i):
	if s[i] == t[0]:
		for j in range(num_t):
			if s[i+j] not in (t[j],'?'):
				return False
		else:
			return i
	else:
		return False

for i in range(num_s-num_t+1):
	idx = match(s,i)
	if idx != False:
		idx_t.append(idx)

if len(idx_t) == 0:
	print('UNRESTORABLE')
else:
	s0 = s
	s_l = []
	for i in idx_t:
		if i+num_t < num_s:
		  s0 = s0[:i] + t + s0[i+t:]
		else:
			s0 = s0[:i] + t
		s_l.append(s0)
	ans = min(s_l)
	print(ans.replace('?','a',100))
	
				

### FIXED CODE ###

s = input()
t = input()
num_s = len(s)
num_t = len(t)
idx_t = []

def match(s,i):
	if s[i] in (t[0],'?'):
		for j in range(num_t):
			if s[i+j] not in (t[j],'?'):
				return '!'
		return i
	else:
		return '!'

for i in range(num_s-num_t+1):
	idx = match(s,i)
	if idx != '!':
		idx_t.append(idx)

if len(idx_t) == 0:
	print('UNRESTORABLE')
else:
	s0 = s
	s_l = []
	for i in idx_t:
		if i == 0:
			s1 = t + s0[num_t:]
		elif i != num_s-num_t:
		  s1 = s0[:i] + t + s0[i+num_t:]
		else:
			s1 = s0[:i] + t
		s_l.append(s1)
	ans = min(s_l)
	print(ans.replace('?','a',100))
import numpy as np
n, a = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
xs=sum(x)
dp= np.zeros((n+1,n+1,n*a+1),dtype=int)
dp[0][0][0]=1
ans=0

for k in range(1,n+1):
  for i in range(0,k+1):
    for j in range(0,xs*n+1):
      if j>=x[k-1] and i>=1:
        dp[k][i][j]= dp[k-1][i][j] + dp[k-1][i-1][j-x[k-1]]
      else:
        dp[k][i][j]= dp[k-1][i][j] 
      
for i in range(1,n+1):
  ans+=dp[n][i][a*i]

print(ans)

### FIXED CODE ###

n, a = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

dp=[[0 for i in range(a*n+1)] for j in range(n+1)]
dp[0][0]=1
ans=0
f=0

for k in range(1,n+1):
  kx=x[k-1]
  f+=kx
  for i in range(k,0,-1):
    for j in range(kx,a*n+1):
      dp[i][j] += dp[i-1][j-kx]
      if j > f:
        break
      
for i in range(1,n+1):
  ans+=dp[i][a*i]

print(ans)
D,N = map(int,input().split())
k = 100**D
m = 100**(D+1)
cnt = 0
for i in range(1,200):
  if (i*k)%m != 0:
    cnt +=1
    if cnt =N:
      print(i*k)
      break

### FIXED CODE ###

D,N = map(int,input().split())
k = 100**D
m = 100**(D+1)
cnt = 0
for i in range(1,200):
  if (i*k)%m != 0:
    cnt +=1
    if cnt ==N:
      print(i*k)
      break
import math
n, a, b = map(int,input().split())
score = 1
total = 0
if n % 2 = 1:
  for i in range(1,n//2+1):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
else:
  for i in range(1,n//2):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
  k = n//2 
  if k != a and k != b and k != n-a and K != n-b:
    total + score * (n-k+1) // k
print(total % (10**9 + 7))


### FIXED CODE ###

N, a, b = map(int,input().split())
p = pow(10,9) + 7
def comb(n,r):
  bunshi = 1
  for i in range(n-r+1, n+1):
    bunshi =bunshi * i % p
  bunbo = 1
  for i in range(1, r+1):
    bunbo = bunbo * i % p
  return bunshi * pow(bunbo, p-2, p)
print((pow(2,N, p) - 1 - comb(N,a) - comb(N,b)) % p)