Harryxun/stf_run huggingface dataset:
from test import set_stdin_sandbox
set_stdin_sandbox("at87")

from pydoc import help# {{{
import re
from scipy import integrate
from operator import itemgetter
from collections import Counter
from collections import deque
import fractions
from heapq import heappop, heappush, heapify
import sys
import array
from copy import deepcopy as dcopy
from scipy.special import factorial
import sympy
import time
# }}}

from bisect import bisect_left, bisect_right, insort_left, insort_right

import numpy as np

import itertools
import pandas as pd
import math 
from collections import defaultdict as dd
import numpy as np
import pandas as pd
def main():
	a = int(input())
	b = int(input())
	c = int(input())
	x = int(input())

	count = 0
	for i in range(a+1):
		y = x- 500*i
		if y == 0:
			count += 1
			continue
		if y > 0:
			for j in range(b+1):
				z = y - j*100
				if z == 0:
					count += 1
					continue
				if z > 0:
					for k in range(c+1):
						if int(z-50*k) == 0:
							count += 1
							break

	print (count)

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()



### FIXED CODE ###

def main():
	a, b, c, x = (int(input()), int(input()), int(input()), int(input()))

	count = 0
	for i in range(a+1):
		y = x- 500*i
		if y == 0:
			count += 1
			continue
		if y > 0:
			for j in range(b+1):
				z = y - j*100
				if z == 0:
					count += 1
					continue
				if z > 0:
					for k in range(c+1):
						if int(z-50*k) == 0:
							count += 1
							break

	print (count)

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()
a, b, k = map(int, input().split())
if a >= k:
  print('{} {}'.format(a-k.b))
elif a+b >= k:
  print('0 {}'.format(b-(k-a)))
else:
  print('0 0')


### FIXED CODE ###

a, b, k = map(int, input().split())
if a >= k:
  print('{} {}'.format(a-k,b))
elif a+b >= k:
  print('0 {}'.format(b-(k-a)))
else:
  print('0 0')
import bisect
import math
A,B,Q = map(int,input().split())
a = []
b = []
x = []
for i in range(A):
  a.append(int(input()))
for j in range(B):
  b.append(int(input()))
for k in range(Q):
  x.append(int(input()))
a.insert(0,-(10**15))
a.append(10**15)
b.insert(0,-(10**15))
b.append(10**15)
for k in range(Q):  
  terafirst = 0
  jinjyafirst = 0
  p = bisect.bisect_left(a,x[k])
  q = bisect.bisect_left(b,x[k])
  terafirst = min(abs(x[k]-a[p-1]),abs(x[k]-a[p]))
  if abs(x[k]-a[p-1])<abs(x[k]-a[p]):
    r = bisect.bisect_left(b,a[p-1])
    terafirst += min(abs(b[r-1]-a[p-1]),abs(b[r]-a[p-1]))
  else:
    s = bisect.bisect_left(b,a[p])
    terafirst += min(abs(b[s-1]-a[p]),abs(b[s]-a[p]))
      
  jinjyafirst = min(abs(x[k]-b[q-1]),abs(x[k]-b[q]))
  if abs(x[k]-b[q-1])<abs(x[k]-b[q]):
    t = bisect.bisect_left(a,b[p-1])
    jinjyafirst += min(abs(a[t-1]-b[q-1]),abs(a[t]-b[q-1]))
  else:
    u = bisect.bisect_left(a,b[q])
    jinjyafirst += min(abs(a[u-1]-b[q]),abs(a[u]-b[q]))
  print(min(terafirst,jinjyafirst))

### FIXED CODE ###

import bisect
A,B,Q = map(int,input().split())
a = []
b = []
x = []
for i in range(A):
  a.append(int(input()))
for j in range(B):
  b.append(int(input()))
for k in range(Q):
  x.append(int(input()))
a.insert(0,-(10**15))
a.append(10**15)
b.insert(0,-(10**15))
b.append(10**15)
for k in range(Q):  
  p = bisect.bisect_left(a,x[k])
  q = bisect.bisect_left(b,x[k])
  teraleft_right = [a[p-1],a[p]]
  jinjyaleft_right = [b[q-1],b[q]]
  minlist = []
  for i in range(2):
    for j in range(2):
      minlist.append(abs(x[k]-teraleft_right[i])+abs(teraleft_right[i]-jinjyaleft_right[j]))
      minlist.append(abs(x[k]-jinjyaleft_right[i])+abs(jinjyaleft_right[i]-teraleft_right[j]))
  minlist.sort() 
  print(minlist[0])
import math
 
N=int(input())
if N%1000==0:
  print(0)
elif N<1000:
  N=1000-N
  print(N)
else:
  N=(math.ceil(money/1000))*1000-N
  print(N)
  
  

### FIXED CODE ###

n = int(input())

if n % 1000 == 0:
  print(0)
else:
  print(1000-(n%1000))
N,M=map(int,input().split())
dict=defaultdict(int)
l1=[]
l2=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        l1.append(b)
    if b==N:
        dict[a]=1
for i in l1:
    if dict[i]:
        print("POSSIBLE")
        quit()
print("IMPOSSIBLE")


### FIXED CODE ###

from collections import defaultdict
N,M=map(int,input().split())
dict=defaultdict(int)
l1=[]
l2=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        l1.append(b)
    if b==N:
        dict[a]=1
for i in l1:
    if dict[i]:
        print("POSSIBLE")
        quit()
print("IMPOSSIBLE")
import math
n,m=map(int,input().split())
s=input()
t=input()
c=0
for i in range(m):
    for j in range(n):
        if m*j==n*i:
            if s[j]==t[i]:
                continue
            else:
                c+=1
                break
        else:
            continue
            
if c!=0:
    print(-1)            
                        
else:
    
    print(n*m//(math.gcd(n,m)))
    


### FIXED CODE ###

def gcd(a,b):
    if b:
        return gcd(b,a%b)
    else:
        return a    

n,m=map(int,input().split())
s=input()
t=input()
c=0
g=gcd(n,m)
x=n*m//(gcd(n,m))
for k in range(g):
    if s[int(k*n/g)]==t[int(k*m/g)]:
        continue
    else:
        c=-1
        break
       
if c==-1:
    print(c)            
                        
else:
    print(x)
import sys
import math

def isExponential(i : int) -> bool:
    for j in range(2,math.ceil(math.sqrt(i))+1):       
        devidend = i
        devisor = j
        #print(devidend,devisor,"inFor") 
        while 1:
            #print(devidend,devisor,"inWhile")
            if devidend % devisor != 0:
                break
            else:
                if devidend == devisor:
                    return True
                else:
                    devidend //= devisor
    return False

x = int(input())
if x == 1:
    print(1)
for i in range(x,0,-1):
    if isExponential(i) == True:
        #print(i)
        #print("wtf")
        break
    else:
        print(i,"False")

### FIXED CODE ###

a,b,c,d = list(map(int, input().split()))
print("Yes" if abs(a-c)<= d or abs(a-b)<=d and abs(c-b) <= d else "No")
def resolve():
	X = int(input())
	if 400<= x < 600:
		print(8); return
	elif 600<= x < 800:
		print(7); return
	elif 800<= x < 1000:
		print(6); return
	elif 1000<= x < 1200:
		print(5); return
	elif 1200<= x < 1400:
		print(4); return
	elif 1400<= x < 1600:
		print(3); return
	elif 1600<= x < 1800:
		print(2); return
	elif 1800<= x < 2000:
		print(1); return
resolve()

### FIXED CODE ###

def resolve():
	x = int(input())
	if 400<= x < 600:
		print(8); return
	elif 600<= x < 800:
		print(7); return
	elif 800<= x < 1000:
		print(6); return
	elif 1000<= x < 1200:
		print(5); return
	elif 1200<= x < 1400:
		print(4); return
	elif 1400<= x < 1600:
		print(3); return
	elif 1600<= x < 1800:
		print(2); return
	elif 1800<= x < 2000:
		print(1); return
resolve()
n, m=map(int, input().split())
grid = []
for i in range(m):
    array = list(map(int, input().strip().split()))
    grid.append(array)


maxa=0
maxb=0
for i in range (1,m):
    if maxa<gird[i][0]:
        maxa=gird[i][0]
    if grid[i][1]<grid[i][0]:
        maxb=grid[i][1]

v=maxb-maxa+1
if v>0:
    print(v)
else:
    print(0)

### FIXED CODE ###

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


maxa,mina=grid[0]
for i in range(1,m):
    if maxa<grid[i][0]:
        maxa=grid[i][0]
    if mina>grid[i][1]:
        mina=grid[i][1]

v=mina-maxa+1
if v>0:
    print(v)
else:
    print(0)
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
r.sort()
for i in range(len(eat)):
    if len(r) != 0 and eat[i] < r[-1]:
        eat[i] = r.pop(-1)
    else:
        break

print(sum(eat))


### FIXED CODE ###

s = list(input())

ret = (s[2] == s[3]) and (s[4] == s[5])
if ret:
    print('Yes')
else:
    print('No')
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
N = int(input())
if a == 1:
  print(0)
  exit()
a = factorization(N)
cnt = 0
for i in a:
  temp = i[1]-1
  d = 2
  while temp>=d:
    temp -= d
    d += 1
  cnt+=d-1
print(cnt)
  
  
  
  
  
  

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
N = int(input())
if N == 1:
  print(0)
  exit()
a = factorization(N)
cnt = 0
for i in a:
  temp = i[1]-1
  d = 2
  while temp>=d:
    temp -= d
    d += 1
  cnt+=d-1
print(cnt)
n, k = int(input())
l_n = [0] * n
for i in range(0, k):
    d = int(input())
    a = int(input())
    for l in a:
        l_n[l-1] = 1
print(l_n.count(0)) 

### FIXED CODE ###

n, k = map(int, input().split())
l_n = [0] * n
for i in range(0, k):
    d = int(input())
    a = map(int, input().split())
    for l in a:
        l_n[l-1] = 1
print(l_n.count(0))
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
MOD = 10 ** 9 + 7
A_max = A[K-1]
A_min = A[-K]
x = 1
count = 1
ans = A_max - A_min
for i in range(K,N):
    x = x * i // count
    #x %= MOD
    count += 1
    #print(x,i,count)
    A_tmp = (A[i] - A[-1*i-1])* x) 
    #print(A_max,A_min)
    ans = (ans + A_tmp) % MOD
print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
mod = p = 10 ** 9 + 7

fact = [1]
fact_inv = [1]
for i in range(10**5+5):
    new_fact = fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))
 
 
def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod    

A_max = 0
A_min = 0
for i in range(N-K+1):
    A_max = (A_max + (A[(K-1)+i] * mod_comb_k((K+i-1),i,p))) % p   
    A_min = (A_min + (A[-1*(K+i)] * mod_comb_k((K+i-1),i,p))) % p
    #print(A_max,A_min,cmb((K+i),i,p))
ans = (A_max - A_min)
if ans < 0:
    ans = p + ans
ans %= p
print(ans)
n = input()
s = ""
for i in range(1,n+1):
    if(i%3==0 or i%10==3):
        s += " " + str(i)
print(s,end(""))


### FIXED CODE ###

n = int(input())
print(" ",end="")
print(*[i for i in range(1,1+n) if i%3==0 or'3' in str(i)])
a,b,c= map(int, input().split())

if (b/a) => c:
  print(c)
else:
  print(b/a)

### FIXED CODE ###

a,b,c= map(int, input().split())
d=int(b/a)
if d>= c:
  print(c)
else:
  print(d)
def main():
  import sys
  input = sys.stdin.readline
  n, m = map(int, input().split())
  h = list(map(int, input().split()))
  ab = [list(map(int, input().split())) for _ in range(m)]
  L = [0] * n

  for i in range(m):
      A =ab[i][0]-1
      B =ab[i][1]-1
      M = max(h[A],h[B])
      if M == h[A]:
          L[A] += 0.33
          L[B] -= 100
      else: 
          L[B] += 0.33
          L[A] -= 100
      
  L= list(filter(lambda x: x >= 0, L))
  print(len(L))

if __name__ == '__main__':
    main()


### FIXED CODE ###

s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')
x=int(input())
n = 1000
l = [x**5 for x in range(n)]
for i,y in enumerate(l):
    if abs(x-y) in l:
        print(f"{l.index(x-y)} {-i}")
        break


### FIXED CODE ###

x = int(input())
for a in range(1000):
    for b in range(1000):
        if a**5 - b**5 == x:
            print(f"{a} {b}")
            break
        elif a**5 - (-b)**5 == x:
            print(f"{a} {-b}")
            break
    else:
        continue
    break
import sys
N,M = map(int, input(). split())
s = [0,]*M
c = [0,]*M
ans =[10,]*M 
for i in range(M):
    s[i], c[i] = map(int, input(). split())
    if ans[s[i]-1] != 10 and ans[s[i]-1] != c[i]:
        print(-1)
        sys.exit()
    else:
        ans[s[i]-1] = c[i]

if ans[0] == 0:
    print(-1)
    sys.exit()
elif ans[0] == 10:
    ans[0] = 1
    A = 0
    for j in range(N):
        if ans[j] == 10:
            ans[j] = 0
    for k in range(N):
        A += 10**(M-(k+1))*ans[k] 
    print(A)
        
else:
    A = 0
    for j in range(N):
        if ans[j] == 10:
            ans[j] = 0
    for k in range(N):
        A += 10**(M-(k+1))*ans[k] 
    print(A)
    
    


    

### FIXED CODE ###

import sys
N,M = map(int, input(). split())

s = [0,]*M
c = [0,]*M
ans =[10,]*N



for i in range(M):
    s[i], c[i] = map(int, input(). split())
    if ans[s[i]-1] != 10 and ans[s[i]-1] != c[i]:
        print(-1)
        sys.exit()
    else:
        ans[s[i]-1] = c[i]       
if N >= 2:
        
    A = 0        
    if ans[0] == 0:
        print(-1)
        sys.exit()
    elif ans[0] == 10:
        ans[0] = 1
        for j in range(N):
            if ans[j] == 10:
                ans[j] = 0
        for k in range(N):
            A += 10**(N-k-1)*ans[k] 
    
        print(A)
        
    else:
        for j in range(N):
            if ans[j] == 10:
                ans[j] = 0
        for k in range(N):
            A += 10**(N-k-1)*ans[k] 
        print(A)
else:
    A = 0
    if ans[0] == 0 or ans[0] == 10:
        print(0)
    else:
        print(ans[0])
a,b=map(int,input().split())
d=int(a/b)
r=a%b
f=a/b
print(d,r,f,sep(" "))

### FIXED CODE ###

a,b=map(int,input().split())
d=a//b
r=a%b
f=a/b
print("{0} {1} {2:.5f}".format(d,r,f))
def make_guide():
    num: int = int(input())
    lst = [(i + 1, *input().split()) for i in range(num)]
    lst = sorted(sorted(lst, key=lambda t: t[2]), key=lambda t: t[1])
    return lst


def test_display():
    lst = make_guide()
    for i, lst in lst:
        print(str(i) + " " + lst[0] + " " + lst[1])


def display():
    lst = make_guide()
    for i, city, point in lst:
        print(i)


if __name__ == "__main__":
    display()

### FIXED CODE ###

def make_guide():
    num = int(input())
    lst = [(i + 1, input().split()) for i in range(num)]
    # TODO fix
    # 同じものが存在したら、っていう条件のもとでないとダメ
    # あと数字は降順
    lst = sorted(lst, key=lambda t: int(t[1][1]), reverse=True)
    lst = sorted(lst, key=lambda t: t[1][0])
    return lst


def test_display():
    lst = make_guide()
    for i, guides in lst:
        print(str(i) + " " + guides[0] + " " + guides[1])


def display():
    lst = make_guide()
    for i, guides in lst:
        print(i)


if __name__ == "__main__":
    display()
import math as mt
n,k=map(int,input().split())
print(mt.ceil(mt.log(n,k)))


### FIXED CODE ###

n,r=map(int,input().split())
print(r+(100*(10-min(n,10))))
N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]

UF = list(range(N + 1))
SIZE = [0] + [1] * N  # 1-indexed


def find(x):
    if UF[x] != x:
        UF[x] = find(UF[x])
    return UF[x]


def unite(x, y):
    if not is_same(x, y):
        X, Y = find(x), find(y)
        SX, SY = SIZE[X], SIZE[Y]
        if SX > SY:
            m = UF[X] = Y
        else:
            m = UF[Y] = X
        SIZE[m] = SX + SY
        SIZE[X + Y - m] = 0


def is_same(x, y):
    return find(x) == find(y)


def scan_uf():
    for i in range(len(UF)):
        find(i)


ans = [N * (N - 1) // 2]
for a, b in AB[::-1]:
    sA = SIZE[find(a)]
    sB = SIZE[find(b)]
    unite(a, b)
    new = SIZE[find(a)]
    ans += [
        ans[-1] - new * (new - 1) // 2 + sA * (sA - 1) // 2 +
        sB * (sB - 1) // 2
    ]
print(*ans[-2::-1], sep='\n')


### FIXED CODE ###

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]

UF = list(range(N + 1))
SIZE = [1] * (N + 1)


def find(x):
    if UF[x] != x:
        UF[x] = find(UF[x])
    return UF[x]


def unite(x, y):
    m = min(find(x), find(y))
    SIZE[m] = SIZE[find(x)] + SIZE[find(y)]
    UF[find(x)] = m
    UF[find(y)] = m


def is_same(x, y):
    return find(x) == find(y)


ans = [N * (N - 1) // 2]
for a, b in AB[::-1]:
    if not is_same(a, b):
        ans += [ans[-1] - SIZE[find(a)] * SIZE[find(b)]]
        unite(a, b)
    else:
        ans += [ans[-1]]
print(*ans[M - 1::-1], sep='\n')
N,Q = map(int,input().split())
s = input()
info = [input().split() for _ in range(Q)]

def biserch(ok,ng,judge):
    while abs(ok-ng) > 1:
        mid = (ok+ng) // 2
        if judge(mid):
            ok = mid
        else:
            ng = mid
    return ok

def left_out(i):
    now = i
    for t, d in info:
        if s[now] == t:
            if d == "L":
                now -= 1
            elif d == "R":
                now += 1
        if now < 0:
            return True
    return False

def right_out(i):
    now = i
    for t, d in info:
        if s[now] == t:
            if d == "L":
                now -= 1
            elif d == "R":
                now += 1
        if now > N-1:
            return True
    return False

left = biserch(ok=-1,ng=N,judge=left_out)
right = biserch(ok=N,ng=-1,judge=right_out)
ans = right - (left + 1)
print(ans)

### FIXED CODE ###

N,Q = map(int,input().split())
s = input()
info = [input().split() for _ in range(Q)]

def left_out():
    left = -1; right = N
    while right - left > 1:
        mid = (left+right) // 2
        if judge(mid) == -1:
            left = mid
        else:
            right = mid
    return left

def right_out():
    left = -1; right = N
    while right - left > 1:
        mid = (left+right) // 2
        if judge(mid) == 1:
            right = mid
        else:
            left = mid
    return right

def judge(i):
    now = i
    for t, d in info:
        if s[now] == t:
            if d == "L":
                now -= 1
            elif d == "R":
                now += 1
        if now < 0:
            return -1
        elif N <= now:
            return 1
    return 0
    
left = left_out()
right = right_out()
ans = right - left - 1
print(ans)
from collections import deque
from copy import copy

N = int(input())
result = [0]*N

if N < 6:
    for i in range(N):
        print(0)
    exit()

result[5] += 1

coord = deque()
coord.append([[1,1,1], 6, 0])

while len(coord):
    sol, ans, level = coord.popleft()
    for i in range(level, 3):
        new_sol = copy(sol)
        new_sol[i] += 1
        new_ans = ans + sum(sol) + sol[i] + 1
        if new_ans <= N:
            coord.append([new_sol, new_ans, i])
            result[new_ans] += 1

print(*result, sep='\n', end='')



### FIXED CODE ###

from collections import deque
from copy import copy

N = int(input())
result = [0]*N

if N < 6:
    for i in range(N):
        print(0)
    exit()

result[5] += 1

coord = deque()
coord.append([[1, 1, 1], 6, 0])

while len(coord):
    sol, ans, level = coord.popleft()
    for i in range(level, 3):
        new_sol = copy(sol)
        new_sol[i] += 1
        new_ans = ans + sum(sol) + sol[i] + 1
        if new_ans <= N:
            coord.append([new_sol, new_ans, i])
            result[new_ans-1] += 1

print(*result, sep='\n', end='')
n=int(input())
a=list(map(int,input().split()))

ans=mx=0
for x in a:
    mx=max(mx,x)
    ans+=mx-x

print(ans)


### FIXED CODE ###

N,X,T=map(int,input().split())
print((N//X+(N%X!=0))*T)
a,b,c=map(int,input().split())
if c>a:
    if b>c:
        print("Yes")
        else:
            print("No")
else:
    print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if c>=a:
    if b>=c:
        print("Yes")
    else:
            print("No")
else:
    if b<=c:
        print("Yes")
    else:
            print("No")
s = input()
t = input()
S = ''.join(list(sorted(s)))
T = ''.join(list(sorted(t,reverse = true)))
print("Yes" if S < T else "No")


### FIXED CODE ###

s = input()
t = input()
S = ''.join(list(sorted(s)))
T = ''.join(list(sorted(t,reverse = True)))
print("Yes" if S < T else "No")
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if j+1<W and i+1<H and j-1>=0 and i-1>=0:
                if (s[j+1][i]=='#' or s[j][i+1]=='#'or s[j][i-1]=='#',or s[j-1][i]=='#'):
                    continue
                if s[j+1][i]!='#' or s[j][i+1]!='#' or s[j-1][i]!='#' or s[j][i-1]!='#':
                    sys.exit()
print('Yes')


### FIXED CODE ###

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

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')
d, n = map(int, input().split())

ans = []
if d == 0:
    x = 1
    while True:
        if x % 100 != 0 and x % 10000 != 0:
            ans.append(x)
        x += 1
        if len(ans) == n:
            break
elif d == 1:
    x = 100
    while True:
        if x % 10000 != 0:
            ans.append(x)
        x += 100
        if len(ans) == n:
            break
else:
    x = 10000
    while True:
       if x % 100000000 != 0:
       ans.append(x)
        x += 10000
        if len(ans) == n:
            break

print(ans[-1])

### FIXED CODE ###

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

if n == 100:
    print(101 * (100**d))
else:
    print(n * (100**d))
# -*- coding: utf-8 -*-
from math import log2

line = list(map(int, input().split(" ")))
n = line[0]
m = line[1]
d = line[2]

if 2*d<n and d>0:
    ret1 = 1+(m-2)*log2(n)
    ret2 = log2(m-d)
    ret3 = log2(m-1)
    ret4 = m*log2(n)
    print(2**(ret1+ret2+ret3-ret4))
else:
    ret1 = (m-1)*log2(n)
    ret2 = log2(m-1)
    ret3 = m*log2(n)
    print(2**(ret1+ret2-ret3))


### FIXED CODE ###

# -*- coding: utf-8 -*-
from math import log2

line = list(map(int, input().split(" ")))
n = line[0]
m = line[1]
d = line[2]

if 2*d<n and d>0:
    ret1 = 1+(m-2)*log2(n)
    ret2 = log2(n-d)
    ret3 = log2(m-1)
    ret4 = m*log2(n)
    print(2**(ret1+ret2+ret3-ret4))
else:
    ret1 = (m-1)*log2(n)
    ret2 = log2(m-1)
    ret3 = m*log2(n)
    print(2**(ret1+ret2-ret3))
import numpy as np

if __name__=="__main__":
    inputs_number  = lambda : [int(x) for x in input().split()]
    N, Ma, Mb = inputs_number()
    drugs = [inputs_number() for i in range(N)]

    inf = 100*N + 1
    dp = np.ones((N+1,N*10+1,N*10+1)) * inf
    dp[0,0,0] = 0
    for i in range(N):
	for ca in range(N*10+1):
            for cb in range(N*10+1):
		if(dp[i,ca,cb]==inf):
                    continue
                dp[i+1,ca,cb]=np.min([dp[i+1,ca,cb],dp[i,ca,cb]])
                dp[i+1,ca+drugs[i][0],cb+drugs[i][1]]=np.min([dp[i+1,ca+drugs[i][0],cb+drugs[i][1]],dp[i,ca,cb]+drugs[i][2]])

    ans = inf
    for ca in range(1, N*10+1):
        for cb in range(1, N*10+1):
	    if(Ma*cb==Mb*ca and dp[N,ca,cb]<ans):
            	ans = dp[N,ca,cb]
    if(ans==inf):
	ans = -1
    print(int(ans))

### FIXED CODE ###

import numpy as np
import copy

if __name__=="__main__":
    inputs_number  = lambda : [int(x) for x in input().split()]
    N, Ma, Mb = inputs_number()
    drugs = [inputs_number() for i in range(N)]
    inf = 100*N + 1
    dp = np.ones((2,N*10+1,N*10+1)).astype(np.int32) * inf
    dp = dp.tolist()
    dp[0][0][0] = 0.0

    for i in range(N):
        for ca in range(10*i+1):
            for cb in range(10*i+1):
                if(dp[0][ca][cb]==inf):
                    continue
                dp[1][ca][cb]=min([dp[1][ca][cb], dp[0][ca][cb]])
                dp[1][ca+drugs[i][0]][cb+drugs[i][1]]=min([dp[1][ca+drugs[i][0]][cb+drugs[i][1]], dp[0][ca][cb]+drugs[i][2]])
        dp[0] = copy.copy(dp[1])
        dp[1] = (np.ones((N*10+1,N*10+1)).astype(np.int32) * inf).tolist()
    ans = inf
    for ca in range(1, N*10+1):
        for cb in range(1, N*10+1):
            if(Ma*cb==Mb*ca and dp[0][ca][cb]<ans):
                ans = dp[0][ca][cb]
    if(ans==inf):
        ans = -1
    print(int(ans))