Harryxun/stf_run huggingface dataset:
S = list(input())

ans = "AC"

if S[0] != "A":
  ans = "WA"
  
count = 0
for item in S[2:-2]:
  if item == "C":
    count += 1
    
if count != 1:
  ans = "WA"
  
S.remove("A")
S.remove("C")

if "".join(S).lower() != "".join(S):
  ans = "WA"

print(ans)

### FIXED CODE ###

S = list(input())

ans = "AC"
tmp = S[2:-1]

if S[0] != "A":
  ans = "WA"
else:
  S.remove("A")
  
count = 0
for item in tmp:
  if item == "C":
    count += 1
    
if count != 1:
  ans = "WA"
elif count == 1:
  S.remove("C")


if "".join(S).lower() != "".join(S):
  ans = "WA"

print(ans)
S = int(input())
h = S//3600
m = S%3600//60
s = S%60
print(h:m:s)



### FIXED CODE ###

S = int(input())
h = S//3600
m = S%3600//60
s = S%60
print(f"{h}:{m}:{s}")
a, b, c = map(input().split(,))
print(a, b, c)

### FIXED CODE ###

a, b, c = input().split(",")
print(a, b, c)
x=int(input())
l=[]
for b in range (2,32):
    for i in range (1,10):
        if b**i <=x:
            l.append (b**i)
print(max(l))

### FIXED CODE ###

x=int(input())
l=[]
for b in range (1,32):
    for i in range (2,10):
        if b**i <=x:
            l.append (b**i)
print(max(l))
r,c=map(int, input().split())
S=[]
for num in range(c-1):
  A=list(map(int, input().split()))
  S.append(A)
  A.append(sum(A))

#print(list(zip(*S)))
C=[]
for t in (zip(*S)):
  C.append(sum(t))
S.append(C)
for i in S:
  print(*i)

    


### FIXED CODE ###

r,c=map(int, input().split())
S=[]
for num in range(r):
  A=list(map(int, input().split()))
  S.append(A)
  A.append(sum(A))

#print(list(zip(*S)))
C=[]
for t in (zip(*S)):
  C.append(sum(t))
S.append(C)
for i in S:
  print(*i)
(n, m) = [int(i) for i in input().split()]

A = [[]]
b = []


for i in range(n):
    A.append([int(j) for j in input().split()])

for i in range(m):
    b.append(int(input())


for i in range(n):
    c = 0
    for j in range(m):
         c += A[n][m] * b[m]
         print(c)

### FIXED CODE ###

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

A = []
b = []


for i in range(n):
    A.append([int(j) for j in input().split()])

for i in range(m):
    b.append(int(input()))


for i in range(n):
    c = 0

    for j in range(m):
         c += A[i][j] * b[j]

    print(c)
N, M ,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if sum(A) + sum(B) <= K:
    print(len(A) + len(B))
    exit()

a, b = 0, 0
while True:
    if a == N:
        K -= B[b]
        b += 1
    
    elif b == M:
        K -= a[a]
        a += 1

    elif A[a] < B[b]:
        K -= A[a]
        a += 1
    
    elif A[a] > B[b]:
        K -= B[b]
        b += 1

    else:
        tmpa, tmpb = a, b
        while True:
            tmpa += 1
            tmpb += 1
            if tmpa == N:
                K -= B[b]
                b += 1
                break
            elif tmpb == M:
                K -= A[a]
                a += 1
                break
            elif A[tmpa] > B[tmpb]:
                K -= B[b]
                b += 1
                break
            elif A[tmpa] < B[tmpb]:
                K -= A[a]
                a += 1
                break 
    if K < 0:
        break

print(a + b - 1)

### FIXED CODE ###

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

ruiA, ruiB = [0], [0]

for i in range(N):
    ruiA.append(ruiA[i] + A[i])

for j in range(M):
    ruiB.append(ruiB[j] + B[j])

t = False
for i in range(N + M + 1):
    if i <= N and ruiA[i] <= K:
        continue
    if i <= M and ruiB[i] <= K:
        continue
    if i > N and ruiA[N] + ruiB[i - N] <= K:
        continue
    if i > M and ruiA[i - M] + ruiB[M] <= K:
        continue

    t = False
    for j in range(0, i + 1):
        if j > M or i - j > N:
            continue
        if ruiA[i - j] + ruiB[j] <= K:
            t = True
            break

    if not t:
        print(i - 1)
        exit()

print(N + M)
[a,b] = [int(s) for s in input().rstrip().split(' ')]
W = ""
if a < b:
  for i in range(b):
    W.append(str(a))
  print(W)
else:
  for i in range(a):
    W.append(str(b))
  print(W) 
  

### FIXED CODE ###

[a,b] = [int(s) for s in input().rstrip().split(' ')]
W = ""
if a < b:
  for i in range(b):
    W += str(a)
  print(W)
else:
  for i in range(a):
    W += str(b)
  print(W)
import sys
input = sys.stdin.readline

import math

def main(): 

    N=int(input())
    to=[[] for _ in range(N+1)]
    ans=[0]*(N+1)

    for i in range(N-1):
        u,v,w=map(int,input().split())
        print(u,v,w)
        to[u].append([v,w])
        to[v].append([u,w])
    
    def dfs(chil, par):
        for v,l in to[chil]:
            if v == par: continue
            if (ans[chil] == 1 and l%2==0) or (ans[chil] == 0 and l%2==1):
                ans[v]=1
            dfs(v,chil)
    
    ans[1] = 1
    dfs(1,-1)
    print(*ans[1:])
if __name__ == "__main__":
    main()
    

### FIXED CODE ###

import sys
input = sys.stdin.readline

sys.setrecursionlimit(1000000)

def main(): 

    N=int(input())
    to=[[] for _ in range(N+1)]
    ans=[0]*(N+1)

    for i in range(N-1):
        u,v,w=map(int,input().split())
        to[u].append([v,w])
        to[v].append([u,w])
    
    def dfs(chil, par):
        for v,l in to[chil]:
            if v == par: continue
            if (ans[chil] == 1 and l%2==0) or (ans[chil] == 0 and l%2==1):
                ans[v]=1
            dfs(v,chil)
    
    #ans[1] = 1
    dfs(1,-1)
    for i in ans[1:]:
        print(i)
if __name__ == "__main__":
    main()
i = 0
while x=int(input()) != 0:
 i = i + 1
 print("Case " + i + ": " + x)

### FIXED CODE ###

i=0
x=int(input())
while x != 0:
 i = i+1
 print("Case " + str(i) + ": " + str(x))
 x=int(input())
str = input().split()

if str[1] == "+":
  print str[0]+str[2]
else:
  print str[0]-str[2]


### FIXED CODE ###

str = input().split()

if str[1] == "+":
  print(int(str[0]) + int(str[2]))
else:
  print(int(str[0]) - int(str[2]))
N = int(input())
A = list(map(int,input().split()))

AS = list(set(A))
D = {}
for i in A:
    if i in D.keys():
        D[i] += 1
    else:
        D[i] = 1

accum = []
AS.sort(reverse=True)
for i in AS:
    if D[i] >= 2:
       accum.append(i)


if D[accum[0]] >= 4:
    print(accum[0]**2)
elif D[accum[0]] >= 2:
    print(accum[0]*accum[1])
else:
    print(0)

### FIXED CODE ###

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

AS = list(set(A))
D = {}
for i in A:
    if i in D.keys():
        D[i] += 1
    else:
        D[i] = 1

accum = []
AS.sort(reverse=True)
for i in AS:
    if D[i] >= 2:
       accum.append(i)

if len(accum) != 0:
   if D[accum[0]] >= 4:
    print(accum[0]**2)
   elif D[accum[0]] >= 2:
    print(accum[0]*accum[1])
else:
    print(0)
a,b = map(int, raw_input().split())

print ("%d %d %f" %(a//b,a % b,a/float(b))

### FIXED CODE ###

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

print("%d %d %f" % (a//b, a % b, a/float(b)))
N = int(input())
ans = 10*18
for i in range(1, i*i <=N):
    if (N % i != 0): continue
    j = N / i
    ans = min(ans, i + j - 2)

print(ans)

### FIXED CODE ###

from math import sqrt
from sys import exit

N = int(input())

for i in range(int(sqrt(N)) + 1, -1, -1):
    if N % i == 0:
        print((i - 1) + (N // i - 1))
        exit()
import math
k= int(input())
ans = 0
for a in range(1,k+1):
  for b in range(1,1+k):
    for c in range(1,1+k):
      g = math.gcd(a,b,c)
      ans += ans
print(ans)
      

### FIXED CODE ###

import math
k= int(input())
ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      g = math.gcd(a,b)
      g = math.gcd(g,c)
      ans += g
print(ans)
h=list(map(int,input().split()))
x=[[] for _ in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  x[a].append(h[b-1])
  x[b].append(h[a-1])
count=0
for j in range(1,n+1):
  if x[j]==[]:
    count+=1
  else:
    if h[j-1]>max(x[j]):
      count+=1
print(count)
  

### FIXED CODE ###

n,m=map(int,input().split())
h=list(map(int,input().split()))
x=[[] for _ in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  x[a].append(h[b-1])
  x[b].append(h[a-1])
count=0
for j in range(1,n+1):
  if x[j]==[]:
    count+=1
  else:
    if h[j-1]>max(x[j]):
      count+=1
print(count)
n,a,b=map(int,input().split())
if y<a:
    print(a*(n//(a+b))+())
else:
    print(a*(n//(a+b)+1))


### FIXED CODE ###

n,a,b=map(int,input().split())
#x=n//(a+b)
#y=n%(a+b)
if n%(a+b) < a: print(a*(n//(a+b))+(n%(a+b)))
else: print(a*((n//(a+b)+1)))
import sys
X = int(inout())
a = 1
b = 0
for a in rangr(1, 120):
  for b in range(-119, a):
    if pow(a, 5) - pow(b, 5) == X:
      print(a,b)
      sys.exit()

### FIXED CODE ###

import sys
X = int(input())
a = 1
b = 0
for a in range(1, 120):
  for b in range(-119, a):
    if pow(a, 5) - pow(b, 5) == X:
      print(a,b)
      sys.exit()
d = int(input())
C = list(map(int, input().split()))
S = list(list(map(int, input().split())) for i in range(d))
T = list(int(input()) - 1 for i in range(d))

kaisai = [0] * 26
manzoku = 0
date = 0
for t in T:
    date += 1
    kaisai[t] = date
    manzoku += S[date - 1][t]

    for i in range(26):
        manzoku -= C[i] * (date - kaisai[i])
    
    print(manzoku)


### FIXED CODE ###

d = int(input())
c = list(map(int, input().split()))
s = list(map(int, input().split()) for _ in range(d))

import random
for i in range(d):
    print(int(random.uniform(1, 26)))
from math import ceil
n, h = map(int, input().split())
a = []
b = []
for i in range(n):
    ai, bi = map(int,input().split())
    a.append(ai)
    b.append(bi)
ans = 0
maxa = max(a)
b2 = sorted([i for i in b if i > maxa],reverse=True)
for k in b2:
    if h > 0:
        ans += 1
        h -= k
if h > 0: ans += ceil(h/maxa)
print(ans)

### FIXED CODE ###

n,y = map(int, input().split())
for i in range(min(n+1, y//10000+1)):
    for j in range(min(n-i+1, y//1000+1)):
        c = n-i-j
        if 10000 * i + 5000 * j + 1000 * c == y:
            print(i,j,c)
            exit()
print(-1,-1,-1)
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

if A % 10 == 0:
    a = 0
else:
    a = 10 - A % 10

if B % 10 == 0:
    b = 0
else:
    b = 10 - B % 10

if C % 10 == 0:
    c = 0
else:
    c = 10 - C % 10

if D % 10 == 0:
    d = 0
else:
    d = 10 - D % 10

    if E % 10 == 0:
        e = 0
    else:
        e = 10 - E % 10

sum = A + B + C + D + E + a + b + c + d + e - max(a,b,c,d,e)

print(sum)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

if A % 10 == 0:
    a = 0
else:
    a = 10 - A % 10

if B % 10 == 0:
    b = 0
else:
    b = 10 - B % 10

if C % 10 == 0:
    c = 0
else:
    c = 10 - C % 10

if D % 10 == 0:
    d = 0
else:
    d = 10 - D % 10

if E % 10 == 0:
    e = 0
else:
    e = 10 - E % 10

sum = A + B + C + D + E + a + b + c + d + e - max(a,b,c,d,e)

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

if K >= A:
    Anum = A
    N = K - A
else:
    Anum = K

if N >= B:
    Bnum = B
    N = N - B
else:
    Bnum = N

Cnum = N

Total = Anum * 1 + Bnum * 0 + Cnum * (-1)

print(Total)

### FIXED CODE ###

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

if K >= A:
    Anum = A
    N = K - A
else:
    Anum = K
    N = 0

if N >= B:
    Bnum = B
    N = N - B
else:
    Bnum = N
    N = 0

Cnum = N

Total = Anum * 1 + Bnum * 0 + Cnum * (-1)

print(Total)
# coding: utf-8
#解法2 ヒープを使う
import heapq
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

used=[]

heap=[]

heapq.heappush(heap,(-(A[0]+B[0]+C[0]),0,0,0))
used.append((0,0,0))

for i in range(K):
    u=heapq.heappop(heap)
    if not((u[1]+1,u[2],u[3]) in used):
        used.append((u[1]+1,u[2],u[3]))
        heapq.heappush(heap,(-(A[u[1]+1]+B[u[2]]+C[u[3]]),u[1]+1,u[2],u[3]))
        
    if not((u[1],u[2]+1,u[3]) in used):
        used.append((u[1],u[2]+1,u[3]))
        heapq.heappush(heap,(-(A[u[1]]+B[u[2]+1]+C[u[3]]),u[1],u[2]+1,u[3]))
        
    if not((u[1],u[2],u[3]+1) in used):
        used.append((u[1],u[2],u[3]+1))
        heapq.heappush(heap,(-(A[u[1]]+B[u[2]]+C[u[3]+1]),u[1],u[2],u[3]+1))
    print(-u[0])
    


### FIXED CODE ###

# coding: utf-8
#解法1 ABのK番まで　＋　CのK番まで
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

AB=[]

for i in range(X):
    for j in range(Y):
        AB.append(A[i]+B[j])

AB.sort(reverse=True)
C.sort(reverse=True)

ABC=[]

for i in range(min(K,X*Y)):
    for j in range(min(K,Z)):
        ABC.append(AB[i]+C[j])

ABC.sort(reverse=True)

for i in range(K):
    print(ABC[i])
r = int(input(""))
print(r*2*math.pi)


### FIXED CODE ###

import math
r = int(input(''))
print(2*r*math.pi)
s=input()
q= int(input())
 
for iq in range(1,q+1):
	t=input().split()
	if t[0]=='1':
		s=s[::-1]
	else:
		if t[1]=='1':
#			s=t[2]+s
#			s=f"{t[2]}{s}"
			list1=[t[2],s]
			s="".join(list1)
		else:
#			s=s+t[2]
#			s=f"{s}{t[2]}"   
			list2=[s,t[2]]
			s="".join(list2)
 
print (s)


### FIXED CODE ###

str=input()
if str=="AAA" or str=="BBB":
  print ("No")
else:
  print ("Yes")
from math import sqrt
n=int(input())
d=min(-(-int(sqrt(8*n+1))//2),n)
l=list(range(1,d+1))
remain=(d*(d+1))//2-n
while remain<=l[-1]:
    remain-=l[-1]
    l.pop()
print(set(l)-set([remain]))

### FIXED CODE ###

from math import sqrt
n=int(input())
d=min(-(-int(sqrt(8*n+1))//2),n)
l=list(range(1,d+1))
remain=(d*(d+1))//2-n

while remain>=l[-1]:
    remain-=l[-1]
    l.pop()
print(*list(set(l)-set([remain])),sep="\n")
from bisect import bisect_right

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#a,bの累積和
a_sum = [0]
b_sum = [0]
for i in range(N):
    a_sum.append(a_sum[i]+a[i])
for i in range(M):
    b_sum.append(b_sum[i]+b[i])

ans = 0
#Aについて0-N冊読む場合の全探索
for i in range(N+1):
    cntA = i #Aをi冊読む
    rest = K - a_sum[i]#残り時間rest分
    if rest < 0:
        break
    cntB = bisect_right(b_sum,rest)-1 #Bで読むことができる冊数を二分探索で求める
    ans = max(ans,cntA + cntB)
    print(ans)
print(ans)

### FIXED CODE ###

from bisect import bisect_right

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#a,bの累積和
A_sum = [0]
B_sum = [0]
for i in range(N):
    A_sum.append(A_sum[i]+A[i])
for i in range(M):
    B_sum.append(B_sum[i]+B[i])

ans = 0
#Aについて0-N冊読む場合の全探索
for i in range(N+1):
    cntA = i #Aをi冊読む
    rest = K - A_sum[i] #残り時間rest分
    if rest < 0:
        break
    cntB = bisect_right(B_sum,rest)-1 #Bで読むことができる冊数を二分探索で求める
    ans = max(ans,cntA + cntB)
print(ans)
S = ["SUN", "MON","TUE","WED","THU","FRI","SAT"]
d = input()
for i in range(d):
  if d == S[i]:
    print(7 - i)
    break

### FIXED CODE ###

S = ["SUN", "MON","TUE","WED","THU","FRI","SAT"]
d = input()
for i in range(7):
  if d == S[i]:
    print(7 - i)
    break
A,B,C,K = map(int, input().split())
if A >= K:
  print(K)
elif: A + B >= K:
  print(A)
else
  print(A-(K-A-B))

### FIXED CODE ###

A,B,C,K = map(int, input().split())
if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  print(A-(K-A-B))
n, k = map(int, input().split())
mod = 10**9 + 7
s = [0 for i in range(k+1)]
ret = 0

for i in range(k, 0, -1):
    p = int(k/i)
    f = pow(p, n, mod)
    for j in range(2, k+1):
        if i*j <= k+1:
            c -= s[i*j]
        else:
            break
    
    s[i] = c%mod

    ret = (ret + (c%mod)*i)%mod

print(ret)

### FIXED CODE ###

n, k = map(int, input().split())
mod = 10**9 + 7
s = [0 for i in range(k+1)]
ret = 0

for i in range(k, 0, -1):
    p = int(k/i)
    c = pow(p, n, mod)
    for j in range(2, k+1):
        if i*j <= k:
            c -= s[i*j]
        else:
            break
    
    s[i] = c%mod

    ret = (ret + (c%mod)*i)%mod

print(ret)
A, B=map(int, input().split())

if B - A<=1000:
    ans=A
    for i in range(A+1, B+1):
        ans=ans^i
    print(ans)
else:
    lis=[]
    for i in range(A, B+1):
        if i%4==0:
            break
        else:
            lis.append(i)
    for j in range(B, A-1, -1):
        if j%4==0:
            break
        else:
            lis.append(j)
    for i in range(len(lis)):
        if i==0:
            ans=lis[i]
        else:
            ans=ans^i
    print(ans)


### FIXED CODE ###

#40桁
A,B=map(int, input().split())
#print(bin(A),bin(B))
if A==B:
  print(A)
  exit()
#１が奇数個なら１　偶数こなら０
#2**0 偶奇一致　（A-B）%2==0
#010101010101
#2**1 110011001100...
#2**2 11110000111100001111
ans=0
for i in range(40):
  now=0
  aone=False
  bone=False
  if A>>i&1==1:
    aone=True
  if B>>i&1==1:
    bone=True
  amod=(A)%(2**i)
  bmod=(B)%(2**i)
  #print("amod,bmod",amod, bmod)
  left=(A//(2**i))*(2**i)+amod+1
  right=(B//(2**i))*(2**i)+bmod+1
  base=right-left+1
  #print("left, right", left, right)
  if aone:
    now+=2**i-amod
    base-=2**i-amod
  if bone:
    now+=bmod+1
    base-=bmod+1
  if amod!=bmod:
    now+=(base//(2**i))*2
  now+=((base//(2**i))//2)*2**i
  if now%2==1:
    ans+=2**i
  #print(now)
  
print(ans)
n = int(input())
a = list(map(int,input().split()))
ans =[]
sum_rain = sum(a)
a_double = [i*2 for i in a]*2
for i in range(n):
  minus = sum(a_double[i+1:i+n-1:2])
  ans.append(sum_rain-minus)
  

print(' '.join(map(str,ans))
    
    

  
  



### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans =[0]
sum_rain = sum(a)
a_double = [i*2 for i in a]*2
minus = sum(a_double[1:n-1:2])
ans[0] = sum_rain-minus

for i in range(1,n): 
  ans.append(2*a[i-1]-ans[i-1])

print(' '.join(map(str,ans)))
import math

int a;
N, D = map(int, input().split())

for(int i = 0; i < N; i++)
  X, Y = map(int, input().split())
  j = math.sqrt(X**2+Y**2)
  if j <= D:
    a++

pinrt(a)

### FIXED CODE ###

import math
i = 0
a = 0
N, D = map(int, input().split())

while(i < N):
    X, Y = map(int, input().split())
    j = math.sqrt(X ** 2 + Y ** 2)
    if j <= D:
        a+=1
    i+=1

print(a)
import math
import sys
sys.setrecursionlimit(10000000)

n = int(input())
s = int(input())

up = math.sqrt(n)

def colsum(num, base):
    if num < base:
        return num
    else:
        return num%base + colsum(num//base,base)

#s = n(n<b)
if s == n:
    print(n+1)
    exit()

#s > n
if s == n:
    print(-1)
    exit()


#sqrt(n)まで探索
for i in range(2,int(up)+1):
    if s == colsum(n,i):
        print(i)
        exit()

#2桁しかあり得ない場合(sqrt(n)<b<n)
for j in range(1,int(up)+1):
    b = int((n-s)/j) + 1
    if s == colsum(n,b) and b > 1:
        print(i)
        exit()

print(-1)

### FIXED CODE ###

import math
import sys

n = int(input())
s = int(input())

up = math.sqrt(n)

def colsum(num, base):
    if num < base:
        return num
    else:
        return num%base + colsum(num//base,base)

#s >= n
if s == n:
    print(n+1)
elif s > n:
    print(-1)
else:
    #sqrt(n)まで探索
    for i in range(2,int(up)+1):
        if colsum(n,i) == s:
            print(i)
            sys.exit()

    #2桁しかあり得ない場合(sqrt(n)<b<n)
    for j in range(int(up),0,-1):
        if (n-s)%j == 0:
            b = (n-s)/j + 1
            if colsum(n,b) == s and b > 1:
                print(int(b))
                sys.exit()

    print(-1)
N, L = map(int, input().split())
s = [input() for i in range(n)].sort()
print(*s, sep="")



### FIXED CODE ###

N,L =map(int,input().split())
s=sorted([input() for i in range(N)])
print(*s,sep="")
def main():
    n, k = [int(i) for i in input().split()]
    num = [int(i) for  i in input().split()]
    if k >= n:
        return 0
    else:
        num = sorted(num)
        return sum(num[0:n-k])
print(main())


### FIXED CODE ###

def main():
    num = [int(i) for i in input().split()]
    h = num[0]
    a = num[1]
    return attack(h, a)

def attack(h,a):
    if h % a == 0:
        return h // a
    elif h % a >= 1:
        return (h//a) + 1

print(main())
a,b,c,d=map(int,input().split())
l=a+b
r=c+d
if l < r:
  print("Right")
else if l==r:
  print("Blanceed")
else:
  print("Left")


### FIXED CODE ###

a,b,c,d=map(int,input().split())
l=a+b
r=c+d
if l < r:
  print("Right")
elif l==r:
  print("Balanced")
else:
  print("Left")
S = input()
t = input()

tmp1 = 0
tmp2 = 0
res = ''
flag = False
for i in range(len(S) - len(t)):
    h = True
    for j in range(len(t)):
        if S[i+j] != t[j]:
            h = False
    if h == True:
        flag = True
        break
        
if h != True:
            
    while True:
        if S[-tmp1 - 1] == t[-tmp2 - 1]  or S[-tmp1 - 1] == '?':
            res = t[-tmp2 - 1] + res
            tmp1 += 1
            tmp2 += 1
        else:
            tmp1 += 1
            tmp2 = 0
            res = ''


        if tmp2 == len(t):
            flag = True
            break

        if tmp1 == len(S):
            break
      
tmp3 = ''
k = 0
for i in range(len(S)):
    if len(S) - tmp1 <= i < len(S) - tmp1 + len(t):
        tmp3 += t[k]
        k += 1
    elif S[i] == '?':
        tmp3 += 'a'
    else:
        tmp3 += S[i]
        
res = tmp3 
 
if flag:
    print(res)
else:
    print('UNRESTORABLE')


### FIXED CODE ###

S = input()
T = input()


    
if True:
    tmp = -1
    for i in range(len(S) - len(T) + 1):
        start = -1
        for j in range(len(T)):
            if S[i+j] == T[j] or S[i+j] == '?':
                start = i
            else:
                start = -1
                break
                
        
        if start != -1:
                tmp = i
    if tmp == -1:
        print('UNRESTORABLE')
    else:
        res = ''
        count = 0
        for i in range(len(S)):
            if tmp <= i < tmp + len(T):
                res += T[count]
                count += 1
            elif S[i] == '?':
                res += 'a'
            else:
                res += S[i]

        print(res)
#!/usr/bin/env python

A = [input() for i in range(5)]
m = 9
flag = True
for a in A:
    if int(a[-1]) == 0:
        pass
    elif int(a[-1]) <= m:
        flag = False
        m = int(a[-1])
        min_dish = a
B = [int(i) for i in A]
if flag:
    min_dish = min(B)

sum = int(min_dish)
A.remove(min_dish)
for a in A:
    if int(a[-1]) == 0:
        sum += int(a)
    else:
        sum += int(a) + int(10) - int(a[-1])
print(int(sum))

### FIXED CODE ###

#!/usr/bin/env python

A = [input() for i in range(5)]
m = 9
flag = True
for a in A:
    if int(a[-1]) == 0:
        pass
    elif int(a[-1]) <= m:
        flag = False
        m = int(a[-1])
        min_dish = a
B = [int(i) for i in A]
if flag:
    min_dish = str(min(B))
sum = int(min_dish)
A.remove(min_dish)
for a in A:
    if int(a[-1]) == 0:
        sum += int(a)
    else:
        sum += int(a) + int(10) - int(a[-1])
print(int(sum))
'''input
3 14 3 25
3 1 1
'''
a = input()
b = input()
if a > 8 or b > 8 :
	print ":("
else:
	print "Yay!"

### FIXED CODE ###

'''input
4 5
'''
a,b = map(int,raw_input().split())
if a > 8 or b > 8 :
	print ":("
else:
	print "Yay!"
def main():
    from math import gcd
    n, m = map(int, input().split())
    ans = 1
    l = int(m / n)
    for i in range(2, l + 1):
        p, q = divmod(m, i)
        if q != 0 or p < n:
            continue

        ans = max(ans, i)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    for i in range(int(m / n), 0, -1):
        if m % i == 0:
            print(i)
            break


if __name__ == '__main__':
    main()