Harryxun/stf_run huggingface dataset:
a=input().split("¥n")
K=int(a[1])
S_len=len(a[0])
for i in range(S_len):

    if(int(a[0][i])==1):
        K-=1
        if(K<=0):
            print("1")
            break

    elif(int(a[0][i])==2):
        K2=format(K,'b')
        K2_len=len(K2)
        K2_len-=5000*10000*10000*10000
        if(K2_len<=0):
            print("2")
            break
        K=pow(2, K2_len)

    else:
        print(a[0][i])
        break

### FIXED CODE ###

S=input()
S_len=len(S)
K=int(input())
for i in range(S_len):
  if(int(S[i])==1):
    K-=1
    if(K<=0):
      print("1")
      break
  else:
    print(S[i])
    break
import math

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

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

ans = 0
lcm = lcm_base(C,D)
c_num = B//C - (A-1)//C 
d_num = B//D - (A-1)//D
diff = B//lcm - (A-1)//lcm

print(B-A+1-(c_num+d_num-diff))


### FIXED CODE ###

import math
import fractions

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

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

ans = 0
lcm = lcm_base(C,D)
c_num = B//C - (A-1)//C 
d_num = B//D - (A-1)//D
diff = B//lcm - (A-1)//lcm

print(B-A+1-(c_num+d_num-diff))
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))


if K > A[-1]:
    print('IMPOSSIBLE')
else:
    flag = True
    for i in range(N - 1):
        if A[i] % (A[i + 1] - A[i]) == 0 or \
           (A[i + 1] - A[i]) % A[i] == 0:
            flag = False
            break
    if flag:
        print("POSSIBLE")
    else:
        print('IMPOSSIBLE')


### FIXED CODE ###


from fractions import gcd


N, K = map(int, raw_input().split())
A = sorted(list(map(int, raw_input().split())))


if K > A[-1]:
    print('IMPOSSIBLE')
else:
    flag = True
    tmp = reduce(gcd, A)
    if tmp != 1:
        flag = False
    for a in A:
        if a == K or (K - a) % tmp == 0:
            flag = True
            break
    if flag:
        print("POSSIBLE")
    else:
        print('IMPOSSIBLE')
import bisect
import math
import sys
from bisect import bisect_left
from math import ceil, sqrt

q = int(sys.stdin.readline().rstrip())
lr = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(q)]


def era_prime(N):
    temp = [True]*(N+1)
    temp[0] = temp[1] = False
    for i in range(2, ceil(sqrt(N+1))):
        if temp[i]:
            temp[i+i::i] = [False]*(len(temp[i+i::i]))
    primes = [n for n in range(N+1) if temp[n]]
    return primes


primes = era_prime(100000)
post_primes = []
ind = 0
tmp = 0
p = [0]
for pi in primes:
    if (pi + 1) // 2 in primes:
        post_primes.append(pi)

for i in range(1, 100000):
    if ind >= len(post_primes):
        break
    if i == post_primes[ind]:
        tmp += 1
        ind += 1
    p.append(tmp)
for lri in lr:
    ans = 0
    print(p[lri[1]]-p[lri[0]-1])

### FIXED CODE ###

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
c=[0]
ci=0
for i in range(1,10**5+1):
  if is_prime(i) and is_prime((i+1)//2):
    ci+=1
  c.append(ci)
q=int(input())
lr=[list(map(int,input().split())) for _ in range(q)]
for lri in lr:
  print(c[lri[1]]-c[lri[0]-1])
import sys

def chmin(a,i,b):
  if a[i] > b:
    a[i] = b
    #print(a)
    return True
  else:
    return False

n,k = map(int,input().split())
h = list( map(int,input().split()))
dp = [sys.maxsize for i in range(n)]

dp[0] = 0
#print(n,h)
#print(dp)

for i in range(len(dp)):
  for j in range(k+1):
    if i - j >= 0:
      #chmin(dp,i, abs(h[i]-h[i-j])+dp[i-j])
      dp[i] = min(dp[i], abs(h[i]-h[i-j])+dp[i-j])

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


### FIXED CODE ###

import sys

def chmin(a,i,b):
  if a[i] > b:
    a[i] = b
    #print(a)
    return True
  else:
    return False

n = int(input())
h = list( map(int,input().split()))
dp = [sys.maxsize for i in range(n)]

dp[0] = 0
#print(n,h)
#print(dp)

for i in range(len(dp)):
  if i - 1 >= 0:
    chmin(dp,i, abs(h[i]-h[i-1])+dp[i-1])

  if i - 2 >= 0:
    chmin(dp,i, abs(h[i]-h[i-2])+dp[i-2])
    
#print(dp)   
print(dp[-1])
a,b=map(int,input().split())
s=input()
import re
r = '[0-9]{}-[0-9]{}'.format(a,b)
if re.match(r'%s' % r, s) <> None:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

a,b=map(int,input().split())
s=input()
if s.count('-')==1 and s.index('-') ==a:
    print('Yes')
else:
    print('No')
ab=input()
a=ab.split()[0]
b=ab.split()[1]
print("{0} {1}".format(a*b,(a+b)*2))


### FIXED CODE ###

ab=input()
a=int(ab.split()[0])
b=int(ab.split()[1])
s=a*b
l=(a+b)*2
print("{0} {1}".format(s,l))
def main():
    s = input()
    k = int(input())

    m = 0
    ans = ""

    for i in range(len(s)):
        if s[i] != "1":
            m = i
            ans = s[i]
            break
    
    if k < m:
        print(1)
    else:
        print(int(ans))



if __name__ == "__main__":
    main()

### FIXED CODE ###

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

    m = 0
    ans = ""

    for i in range(len(s)):
        if s[i] != "1":
            m = i+1
            ans = s[i]
            break
    
    if k < m:
        print(1)
    elif m == 0:
        print(1)
    else:
        print(int(ans))



if __name__ == "__main__":
    main()
def temp(H):
  ans = - H *0.006
  return ans
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
TE = list(map(temp,H))
TLA = list(map(lambda x: abs(T + x -A) , TE))
ans=TLA.index(min(TLA))
print(ans+1)


### FIXED CODE ###

import math
n = int(input())
counter = False
#for n in range (0,100):
for i in range (math.ceil((n+1) / 4) ):
  for j in range (math.ceil((n+1) / 7) ):
    #print(n, i,j)
    if i*4 + j*7 == n:
      counter = True
if counter == True:
  print("Yes")
else:
  print("No")
if __name__ == '__main__' :
    n = int(input())
    a,b = [int(i) for i in input().split(" ")]
    for i in range(1,min(a,b)+1):
        if((a % i == 0) and (b % i == 0)):
            print(i)



### FIXED CODE ###



if __name__ == '__main__' :
    n = int(input())
    s = [int(i) for i in input().split(" ")]
    for i in range(1,min(s)+1):
        if (sum(map(lambda x : x % i , s)) == 0): print(i)
while 1:
	n = input()
	if n == 0: break
	q = sorted([input() afor i in range(n)])
	t = [0]*n
	for i in range(n-1):
		t[i + 1] = t[i] + q[i]
	print sum(t)

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	q = sorted([input() for i in range(n)])
	t = [0]*n
	for i in range(n-1):
		t[i + 1] = t[i] + q[i]
	print sum(t)
import sys
lines = sys.stdin.readlines()

S = str(lines[0])
X = []
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019


### FIXED CODE ###

S = str(input())

#10**nのmod計算
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

#左からi文字以降の数字列のmod計算
X = []
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)
X.sort()
flag =1
n = 0

#modが同じになる組み合わせ、またはもともとmodが0になる数字列の個数の総和計算
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += int(flag*(flag-1)/2)
    flag = 1
n += int(flag*(flag-1)/2)
if X[len(X)-1]==0:
  n +=1
print(n)
import sys
input = sys.stdin.readline

# D - .. (Double Dots)
from collections import deque
sys.setrecursionlimit(pow(10, 5))

def set_route(start, goal):
	global routes
	
	routes[goal].append(start)


def search(que):
	global routes
	global guides

	if len(que) > 0:
		goal = que.popleft()

		for start in routes[goal]:
			if guides[start] == 0:
				guides[start] = goal
				que.append(start)
		
		search(que)
	else:
		return 


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

# 空の辞書(routes)を作成
for i in range(1, n + 1):
	routes[i] = []

# すべての出入り口の情報を取得("routes"に保存)
for i in range(m):
	a, b = map(int, input().split())
	set_route(a, b)
	set_route(b, a)

# 道しるべ(最後に出力)を保存するためのリスト
guides = [0] * (n + 1)

que = deque()
que.append(1)
search(que)

ans = guides[2:]

if 0 in ans:
	print('No')
else:
	print('Yes')
	
	for a in ans:
		print(a)

### FIXED CODE ###

import sys
input = sys.stdin.readline

# D - .. (Double Dots)
from collections import deque
sys.setrecursionlimit(pow(10, 6))

def set_route(start, goal):
	global routes
	
	routes[goal].append(start)


def search(que):
	global routes
	global guides

	if len(que) > 0:
		goal = que.popleft()

		for start in routes[goal]:
			if guides[start] == 0:
				guides[start] = goal
				que.append(start)
		
		search(que)
	else:
		return 


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

# 空の辞書(routes)を作成
for i in range(1, n + 1):
	routes[i] = []

# すべての出入り口の情報を取得("routes"に保存)
for i in range(m):
	a, b = map(int, input().split())
	set_route(a, b)
	set_route(b, a)

# 道しるべ(最後に出力)を保存するためのリスト
guides = [0] * (n + 1)

que = deque()
que.append(1)
search(que)

ans = guides[2:]

if 0 in ans:
	print('No')
else:
	print('Yes')
	
	for a in ans:
		print(a)
from sympy import divisors
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

n = int(input())
a = make_divisors(n)
cnt = 0
for i in range(1, len(a)):
    b = prime_decomposition(a[i])
    if len(list(set(b))) == 1:
        if n % a[i] == 0:
            n //= a[i]
            cnt += 1
print(cnt)

### FIXED CODE ###

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

n = int(input())
a = sorted(divisor(n))
cnt = 0
for i in range(1, len(a)):
    b = prime_decomposition(a[i])
    if len(list(set(b))) == 1:
        if n % a[i] == 0:
            n //= a[i]
            cnt += 1
print(cnt)
import math
def gcm(a,b):
    k = a * b / math.gcd(a,b)
    return int(k)

A,B,C,D = map(int,input().split())
bk = B - B//C - B//D + B//gcm(C,D)
ak = (A-1) - (A-1)//C - (A-1)//D + (A-1)//gcm(C,D)

print(bk-ak)

### FIXED CODE ###

from fractions import gcd
def gcm(a,b):
    k = a * b / gcd(a,b)
    return int(k)

A,B,C,D = map(int,input().split())
bk = B - B//C - B//D + B//gcm(C,D)
ak = (A-1) - (A-1)//C - (A-1)//D + (A-1)//gcm(C,D)

print(bk-ak)
?import sys

while True:
    h, w = map(int, sys.stdin.readline().split(' '))
    if h == 0 and w == 0:
        break

    for i in range(h):
        for j in range(w):
            sys.stdout.write('#' if (i+j) % 2 == 0 else '.')
        print ''
    print ''
??

### FIXED CODE ###

import sys

while True:
    h, w = map(int, sys.stdin.readline().split(' '))
    if h == 0 and w == 0:
        break

    for i in range(h):
        for j in range(w):
            sys.stdout.write('#' if (i+j) % 2 == 0 else '.')
        print ''
    print ''
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r2  Time Limit Exceeded
@author: maezawa
"""

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m_array = list(map(int, input().split()))
can_c_array = [[None for _ in range(q)] for _ in range(n)]

def can_comp(i, m): #i番目以降の数列をつかってmを作れるか？
    if m == 0:
        return True
    elif i == n:
        return False
    else:
        if can_c_array[i+1][m] == None:
            c1 = can_comp(i+1, m)
            can_c_array[i+1][m] = c1
        else:
            c1 = can_c_array[i+1][m] 
        if can_c_array[i+1][m-a[i]] == None:
            c2 = can_comp(i+1, m-a[i])
            can_c_array[i+1][m-a[i]] = c2
        else:
            c2 = can_c_array[i+1][m-a[i]]     
        return c1 or c2

for m in m_array:
    if can_comp(0, m):
        print('yes')
    else:
        print('no')



### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

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

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)
W,H,x,y,r = input().split()
w = int()
H = int()
x = int()
y = int()
r = int()
if x+r <= W and y+r < H:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

w,h,x,y,r = input().split()
w = int(w)
h = int(h)
x = int(x)
y = int(y)
r = int(r)
if x - r >= 0 and y - r >= 0 and x + r <= w and y + r <= h:
    print("Yes")
else:
    print("No")
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if abs(a - c) <= d:
    print("Yes")
elif (abs(a - b) <= d) and (abs(b - c) <= d):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b, c, d = (int (i) for i in input().split())

if abs(a - c) <= d:
    print("Yes")
elif (abs(a - b) <= d) and (abs(b - c) <= d):
    print("Yes")
else:
    print("No")
n=int(input())
h=list(map(int,input().split()))
a=True
for i in range(n):
  for j in range(i,n):
    if h[i]-h[j]>1:
      a=False
if a==False:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

A,B,C = map(int,input().split())
if A-B>C:
  print(0)
else:
  print(C-(A-B))
A = input().strip()
if(A[3] == A[4] and A[5] == A[6])
    print("Yes")
else
    print ("no")

### FIXED CODE ###

A = input().strip()
if(A[2] == A[3] and A[4] == A[5]):
    print("Yes")
else:
    print ("No")
n,k=map(int,input().split())
d=[]
s=[0]*n
for i in range(k):
    d.append(int(input()))

if 1 in d:
    s[0]=0
else:
    s[0]=1

if 2 in d:
    s[1]=0
else:
    s[1]= s[0]+1


for i in range(2,n):
    if i+1 in d:
        s[i]=0
    else:
        s[i]=(s[i-1]+s[i-2])%1000000007

print( s[n-1] % 1000000007)

  



### FIXED CODE ###

n,k=map(int,input().split())
d=[0]*n
s=[0]*n

if k !=0:
    for i in range(k):
        p=int(input())
        d[p-1]=1

if n==1:
    print(1)
    exit()

 
if d[0]==1:
    s[0]=0
else:
    s[0]=1
 
if d[1]==1:
    s[1]=0
else:
    s[1]= s[0]+1
 
 
for i in range(2,n):
    if d[i]==1:
        s[i]=0
    else:
        s[i]=(s[i-1]+s[i-2])%1000000007
 
print( s[n-1] % 1000000007)
N, X = map(int, input().split())
M = [int(input()) for _ in range(N)]
 
x = X - sum(M)
m = min(M)
print(N + x // m)

### FIXED CODE ###

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

option = input()
print (700 + 100 * option.count('o'))
num=int(input())


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

ans=num2alpha(num).lower()

print(ans)

### FIXED CODE ###

str=input()
a=str.isupper()
if a==True:
    print("A")
else:
    print("a")
x = input()
x = x **3

print int(x)

### FIXED CODE ###

x = input()
y = x**3
print(int(y))
import sys
input_lines = sys.stdin.readlines()
a,b = input_lines.split( )

a = int(a)
b = int(b)

if(b%a==0):
  print(a+b)
else:
  print(b-a)
 


### FIXED CODE ###

import sys
input_lines = sys.stdin.readline()
a,b = input_lines.split( )

a = int(a)
b = int(b)

if(b%a==0):
  print(a+b)
else:
  print(b-a)
n,k = map(int,input().split())
h = int(input())
a = 0
for i in range(n):
    if h[i] > k:
        a += 1
print(a)

### FIXED CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
a = 0
for i in range(n):
    if h[i] >= k:
        a += 1
print(a)
s = input()
k = int(input())

while True:
    if s[0] == '1':
        s = s[1:]
    elif s[0] != '1':
        ans = s[0]
        break
    if s == []:
        ans = 1
        break
print(ans)


### FIXED CODE ###

s = input()
k = int(input())

if s[0] != '1':
    print(s[0])
else:
    len_1 = 0
    while True:
        if s == '1':
            len_1 = 1
            ans = 1
            break
        if s[0] == '1':
            s = s[1:]
            len_1 += 1
        elif s[0] != '1':
            ans = s[0]
            break
    if k > len_1:
        print(ans)
    else:
        print('1')
a = input()
sum = int(a)
for i in range(len(a)-1):
  sum += int(a[i])
  
  sum += int(a[:i+1]) + int(a[i+1:])
sum += int(a[i+1]) 
print(sum)

### FIXED CODE ###

s = input()
n = len(s) - 1
answers = []
sl = [s[i] for i in range(len(s))]
for i in range(2 ** n):
    tmp = []
    for j in range(n):
        if ((i >> j) & 1):
            tmp.append(j)
    ll = ['*']*len(s)
    for k in tmp:
        ll[k] = '+'
    ans = []
    for k, _ in zip(sl, ll):
        ans.append(k)
        ans.append(_)
    ans = [_ for _ in ans if _ != '*']
    ans = ''.join(ans)
    ans = ans.split('+')
    ans = [int(_) for _ in ans if _ != '+']
    ans = sum(ans)
    answers.append(ans)
print(sum(answers))
from collections import deque
import sys
sys.setrecursionlimit(2000000)
N, M = map(int, input().split())
graph = [[] for j in range(M)]
q = deque([])
depth_array = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

def bfs(graph, q, depth_array):
    # 終了条件
    if len(q) == 0:
        return depth_array

    cur_room = q.popleft()

    # キューに追加
    for r in graph[cur_room]:
        if depth_array[r] == -1: #未訪問なら
            q.append(r)
            depth_array[r] = depth_array[cur_room] + 1

    return bfs(graph, q, depth_array)
    
# init
q.append(0)
depth_array[0] = 0
depth_array = bfs(graph, q, depth_array)

mark_array = [-1 for i in range(N)]

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(200000)
N, M = map(int, input().split())
graph = [[] for j in range(N)]
q = deque([])
depth_array = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

def bfs(graph, q, depth_array):
    # 終了条件
    if len(q) == 0:
        return depth_array

    cur_room = q.popleft()

    # キューに追加
    for r in graph[cur_room]:
        if depth_array[r] == -1: #未訪問なら
            q.append(r)
            depth_array[r] = depth_array[cur_room] + 1

    return bfs(graph, q, depth_array)
    
# init
q.append(0)
depth_array[0] = 0
depth_array = bfs(graph, q, depth_array)

mark_array = [-1 for i in range(N)]
#print(depth_array)

for room, depth in enumerate(depth_array):
    for node in graph[room]:
        if depth_array[node] + 1 == depth_array[room]:
            mark_array[room] = node

if -1 in mark_array[1:]:
    print("No")
else:
    print("Yes")
    for m in mark_array[1:]:
        print(m+1)
N,M,K=map(int,input().split())

x=N*M-2*K

if x==0:
    print('Yes')
else:
    for d in range(1,abs(x)+1):
        if x%d==0 and (d<newM and abs(x//d)<newM and (N-d)%2==0 and (M-x//d)%2==0):
            print('Yes')
            break
    else:
        print('No')

### FIXED CODE ###

N,M,K=map(int,input().split())
isYes=False
for n in range(N+1):
    for m in range(M+1):
        if(N*m+M*n-2*n*m==K and not isYes):
            print('Yes')
            isYes=True
if(not isYes):
    print('No')
s = input()
t = input()
n = len(s)
m = len(t)
i = 0
j = 0
point = []
if n<m:
    print("UNRESTORABLE")
    exit()
while i<n:
    if s[i]==t[j] or s[i]=="?":
        j+=1
        i+=1
    else:
        j=0
        i+=1

    if j==m:
        point.append(i-m)
        j = 0
        i -=m
        i+=1
if len(point)==0:
    print("UNRESTORABLE")
    exit()
i = 0
ans = 0
for l in range(len(point)):
    a = (s[:point[l]-1]+t+s[point[l]+m-1:]).replace("?","a")
    ans.append(a)
ans.sort()
print(ans)


### FIXED CODE ###

s = input()
t = input()
n = len(s)
m = len(t)
ans = []
for i in range(n-m+1):
    flag = True
    for j in range(m):
        if s[i+j]!="?" and s[i+j]!=t[j]:
            flag = False
            break
    if flag:
        tmp = (s[:i] + t + s[(i+m):])
        a = []
        for j in range(n):
            if tmp[j]=="?":
                a.append("a")
            else:
                a.append(tmp[j])
        tmp = "".join(a)
        ans.append(tmp)

ans.sort()

if len(ans)>0:
    print(ans[0])
else:
    print("UNRESTORABLE")
s = list(input())
t = list(input())
ans = [-1, -1]
if len(t) <= len(s):
    for i in range(len(s) - len(t) + 1):
        c = 1
        for j in range(len(t)):
            if s[i + j] != "?" and t[j] != s[i + j]:
                c = 0
                break
        if c == 1:
            ans = [i, i + len(t)]

if ans != [-1, -1]:
    k = []
    for i in range(len(s)):
        if ans[0] <= i <= ans[1]:
            k.append(t[i - ans[0]])
        else:
            if s[i] == "?":
                k.append("a")
            else:
                k.append(s[i])
    print("".join(k))
else:
    print("UNRESTORABLE")


### FIXED CODE ###

s = list(input())
t = list(input())
ans = [-1, -1]
if len(t) <= len(s):
    for i in range(len(s) - len(t) + 1):
        c = 1
        for j in range(len(t)):
            if s[i + j] != "?" and t[j] != s[i + j]:
                c = 0
                break
        if c == 1:
            ans = [i, i + len(t)]

if ans != [-1, -1]:
    k = []
    for i in range(len(s)):
        if ans[0] <= i < ans[1]:
            k.append(t[i - ans[0]])
        else:
            if s[i] == "?":
                k.append("a")
            else:
                k.append(s[i])
    print("".join(k))
else:
    print("UNRESTORABLE")
N,D = map(int,input().split())

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

ans = 0
for i in range(N):
  for j in range(i):
    tmp = 0
    for k in range(D):
      tmp += (X[i][k] - X[j][k]) ** 2
    tmp = tmp ** 0.5
    if tmp % 1 == 0:
      ans += 1
      
print(ans)

### FIXED CODE ###

N,A,B = (int(x) for x in input().split())
if N * A < B:
  print( N * A )
else:
  print( B )
a, b = map(int, raw_imput(), split())

if a < b:
 print "a < b" 
elif a == b:
 print "a == b"
elif a > b:
 print "a > b"

### FIXED CODE ###

a, b = map(int, raw_input().split())
 
if a < b:
 print "a < b"
elif a > b:
 print "a > b"
elif a == b:
 print "a == b"