Harryxun/stf_run huggingface dataset:
n,w=map(int, input().split())
lim = min(w,10**5)
dp = [0] * (lim+1)
items = []
mod = 10**5
for _ in range(n):
    ww,v = map(int, input().split())
    items.append((ww,v))
    if ww > mod:
        continue
    for i in range(ww,lim+1)[::-1]:
        # print(i)
        if dp[i-ww] + v > dp[i]:
            dp[i] = dp[i-ww] + v
    # print(dp)
if w <= 10**5:
    print(dp[-1])
    exit()
ll = w-mod
dd = [0] * (ll+1)
for ww,v in items:
    if ww <= mod:
        continue
    u = ww % mod
    for i in range(u,ll+1)[::-1]:
        if dd[i-u] + v > dd[i]:
            dd[i] = dd[i-u] + v
    # print(dp)
print(dp[-1] + dd[-1])


### FIXED CODE ###

from itertools import accumulate
n,w=map(int, input().split())
items = {}
for _ in range(n):
    u,v = map(int, input().split())
    if u not in items:
        items[u] = []
    items[u].append(v)
cost = 0
acc = []
minkey = min(items.keys())
for i in range(4):
    if minkey + i in items:
        items[minkey + i].sort(reverse=True)
        acc.append([0] + list(accumulate(items[minkey + i])))
    else:
        acc.append([0])

ans = 0
for i in range(len(acc[0])):
    a = (i) * minkey
    if w < a:
        continue
    for j in range(len(acc[1])):
        b = (j) * (minkey+1)
        if w < a + b:
            continue
        for k in range(len(acc[2])):
            c = (k) * (minkey+2)
            if w < a + b + c:
                continue
            for l in range(len(acc[3])):
                d = (l) * (minkey+3)
                if w < a + b + c + d:
                    continue
                cost = acc[0][i] + acc[1][j] + acc[2][k] + acc[3][l]
                if cost > ans :
                    ans = cost

print(ans)
md1=map(int,input().split())
md2=map(int,input().split())

print(1 if md1[0]!=md2[0] else 0)

### FIXED CODE ###

md1=list(map(int,input().split()))
md2=list(map(int,input().split()))

print(1 if md1[0]!=md2[0] else 0)
#include <iostream>
#include <unordered_set> 
#include <vector>
#include <algorithm>

using namespace std;
int main() {
	    int a;
	    cin>>a;
	    unordered_set<string> s;
	    while(a--){
	        string  str;
	        cin>>str;
	        string key=str;
	        	if (!(s.find(key) != s.end())){
	        	    s.insert(str); 
	        	}
	    }
	    cout<< s.size()<<endl;
	return 0;
}

### FIXED CODE ###

list1 =[]
number = int(input())
for i in range(0,number):    
    numbers = input()
    list1.append(numbers)
setOfMarks=set(list1)
print(len(setOfMarks))
n,w=map(int,input().split())
dp=[0 for j in range(w+1)]
c,p=map(int,input().split())
dp[c]=p
for i in range(1,n+1):
  c,p=map(int,input().split())
  for j in range(w,1,-1):
    if dp[j]<dp[j-c]+p:
      dp[j]=dp[j-c]+p    
print(max(dp))

### FIXED CODE ###

import sys
input=sys.stdin.readline
 
n,w=map(int,input().split())
dp=[0]*(w+1)
 
def ans(n,w):
  for _ in range(n):
    c,p=map(int,input().split())
    for j in range(w,c-1,-1):
      tmp=dp[j-c]+p
      if dp[j]<tmp:
        dp[j]=tmp
  return max(dp)
print(ans(n,w))
i = 0
while True:
    i++
    x = int(input())
    if x == 0:
        break
    else:
        print('Case {0}: {1}'.format(i, x))

### FIXED CODE ###

i = 0
while True:
    i += 1
    x = int(input())
    if x == 0:
        break
    else:
        print('Case {0}: {1}'.format(i, x))
n, k = map(int, input().split())
p_lis = list(map(int, input().split()))
def calc_ex(num):
    return (num - 1) * 0.5 + 1
cur_num = 0
for i in range(k):
    cur_num += p_lis[i]
max_nums = cur_num
max_nums_i = i
for i in range(len(p_lis) - k):
    cur_num -= p_lis[i]
    cur_num += p_lis[i + k]
    if max_nums < cur_num:
        max_nums = cur_num
        max_nums_i = i + 1
res = 0
for i in range(max_nums_i, max_nums_i + k):
    res += calc_ex(p_lis[i])
print(res)    

### FIXED CODE ###

n, k = map(int, input().split())
p_lis = list(map(int, input().split()))
def calc_ex(num):
    return (num - 1) * 0.5 + 1
cur_num = 0
for i in range(k):
    cur_num += p_lis[i]
max_nums = cur_num
max_nums_i = 0
for i in range(len(p_lis) - k):
    cur_num -= p_lis[i]
    cur_num += p_lis[i + k]
    if max_nums < cur_num:
        max_nums = cur_num
        max_nums_i = i + 1
res = 0
for i in range(max_nums_i, max_nums_i + k):
    res += calc_ex(p_lis[i])
print(res)
A,B,C,D=map(int,input().split())
setAB=set(range(A,B+1))
setC=range(A,B+1,C)
setD=range(A,B+1,D)
setCD=set(setC+setD)
ans=len(setAB)-len(setCD)
print(ans)

### FIXED CODE ###

import fractions
A,B,C,D=map(int,input().split())
listA=range(A)
listB=range(B+1)
listC=range(0,B+1,C)
listAC=range(0,A,C)
listD=range(0,B+1,D)
listAD=range(0,A,D)
listCD=range(0,B+1,C*D//fractions.gcd(C,D))
listACD=range(0,A,C*D//fractions.gcd(C,D))
lenA=len(listA)
lenB=len(listB)
lenC=len(listC)
lenAC=len(listAC)
lenD=len(listD)
lenAD=len(listAD)
lenCD=len(listCD)
lenACD=len(listACD)
ans=lenB-lenA-lenC+lenAC-lenD+lenAD+lenCD-lenACD
print(ans)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


A B = input().split()

if A < B:
    print('<')
elif A > B:
    print('>')
elif A == B:
    print('=')


### FIXED CODE ###

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


A, B = input().split()

if A < B:
    print('<')
elif A > B:
    print('>')
elif A == B:
    print('=')
W, a, b = map(int, input().split())

if a > b + W:
    print(a - (b + w))
elif b > a + W:
    print(b - (a + W))
else:
    print(0)

### FIXED CODE ###


W, a, b = map(int, input().split())

if a > b + W:
    print(a - (b + W))
elif b > a + W:
    print(b - (a + W))
else:
    print(0)
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if n % 3 == 0:
        zero_count = counter[0] 
        if zero_count == n / 3 and len(unique_list) == 2:
            print('Yes')
        else: 
            if len(counter) != 3:
                print('No')
            if (unique_list[0] ^ unique_list[1] == unique_list[2]):
                if (all(counts[0] == num for num in counts)):
                    print('Yes')
            else:
                print('No')
    else:
        print('No')

### FIXED CODE ###

import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if n % 3 == 0:
        zero_count = counter[0] 
        if zero_count == n / 3 and len(unique_list) == 2:
            print('Yes')
        else: 
            if len(unique_list) != 3:
                print('No')
            elif (unique_list[0] ^ unique_list[1] == unique_list[2]):
                if (all(counts[0] == num for num in counts)):
                    print('Yes')
                else:
                    print('No')
            else:
                print('No')
    else:
        print('No')
nums = map(int, input().split())
if nums[0] * nums[1] % 2:
  return "Yes"
return "No"

### FIXED CODE ###

numbers = input()
num_a = int(numbers.split()[0])
num_b = int(numbers.split()[1])
if (num_a * num_b) % 2 == 0:
  print("No")
else:
  print("Yes")
def d170(n,a):
    count=0
    sa=sorted(a)
    dp=[0 for i in range(max(a)+1)]
    if sa[0]==1:
        if sa[1]==1:
            return 0
        else:
            return 1
    else:
        for x in sa:
            if dp[x]!=0:
                dp[x]=2
            else:
                for j in range(x,max(a)+1,x):
                        dp[j]+=1
        for x in sa:
            if dp[x]==1:
                count+=1
        return count
    
n=int(input())
a=list(map(int, input().split()))    
print(d170(n,a))
            

### FIXED CODE ###

def d170(n,a):
    k=max(a)+1
    count=0
    dp=[0 for i in range(k)]
    for x in a:
        if dp[x]!=0:
                dp[x]=2
                
        else:
            for j in range(x,k,x):
                     dp[j]+=1
    for x in a:
        if dp[x]==1:
            count+=1
    return count
    
n=int(input())
a=list(map(int, input().split()))    
print(d170(n,a))
N = int(input())

d = {}

for i in range(N):
    s = input()
    if s in d:
        d[s] = d[s] + 1
    else:
        d[s] = 1

hoge = max(d.values)

max_kv_list = [kv[0] for kv in d.items() if kv[1] == hoge]

max_kv_list = sorted(max_kv_list)
for ans in max_kv_list:
    print(ans)

### FIXED CODE ###

N = int(input())

d = {}

for i in range(N):
    s = input()
    if s in d:
        d[s] = d[s] + 1
    else:
        d[s] = 1

hoge = max(d.values())

max_kv_list = [kv[0] for kv in d.items() if kv[1] == hoge]

max_kv_list = sorted(max_kv_list)
for ans in max_kv_list:
    print(ans)
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def main():
    N, M = map(int, input().split())
    s = input().strip()
    t = input().strip()
    if M > N:
        tmp = s
        s = t
        t = tmp
        tmp = N
        N = M
        M = tmp
    # N >= Mと仮定して良い
    gcd_ = gcd(N, M)
    len_ = N * (M//gcd_)
    st = [""] * len_
    tmp = len_ // N
    for i in range(N):
        st[i*tmp] = s[i]
    ok = True
    tmp = len_ // M
    for i in range(M):
        if st[i*tmp] == "" or st[i*tmp] == t[i]:
            st[i*tmp] = t[i]
        else:
            ok = False
            break
    # print(st)
    if ok:
        print(len_)
    else:
        print(-1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def main():
    N, M = map(int, input().split())
    s = input().strip()
    t = input().strip()
    if M > N:
        tmp = s
        s = t
        t = tmp
        tmp = N
        N = M
        M = tmp
    # N >= Mと仮定して良い
    gcd_ = gcd(N, M)
    len_ = N * (M//gcd_)
    tmp1 = len_ // N
    tmp2 = len_ // M
    # print(tmp1, tmp2)
    ok = True
    for i in range(0, len_, tmp1 * (tmp2//gcd(tmp1, tmp2))):
        # print(i, s[i//tmp1], t[i//tmp2])
        if s[i//tmp1] != t[i//tmp2]:
            ok = False
            break
    if ok:
        print(len_)
    else:
        print(-1)

if __name__ == "__main__":
    main()
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    a,b,k = mi()

    if a-k>0:
        print(a-k,b)
    else:
        k-=a
        print(0,max(b-k,0))


main()




### FIXED CODE ###

#from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    a,b,k = mi()

    if a-k>0:
        print(a-k,b)
    else:
        k-=a
        print(0,max(b-k,0))


main()
a = int(input())
print(r**2)

### FIXED CODE ###

r = int(input())
print(r**2)
import itertools
n = input()
l = list(map(int,input().split()))
ans = 0
for i in list(itertools.combinations(l,3)):
    i.sort()
    a,b,c = i[0],i[1],i[2]
    if c<a+b:
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l = sorted(l)
ans = 0
for c in range(n):
    a=0
    b=c-1
    while a<b:
        if l[a]+l[b]>l[c]:
            ans+=b-a
            b-=1
        else:
            a+=1
print(ans)
inputs = input()

yoko = int(inputs[0])
tate = int(inputs[1])

print((yoko - 1) * (tate - 1))

### FIXED CODE ###

inputs = input().strip().split()

yoko = int(inputs[0])
tate = int(inputs[1])

print((yoko - 1) * (tate - 1))
X = input().split()
S = X[0]
T = X[1]
Y = input().split()
A = int(Y[0])
B = int(Y[1])
U = input()
 
A -= 1 if U == S else B -= 1
 
print(str(A) + " " + str(B))

### FIXED CODE ###

[S, T] = input().split()
[A, B] = [int(x) for x in input().split()]
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)
n = int(input())
ans = 0.0
for i in range(n):
  a, c = input().split()
  a = int(a)
  if c == 'JPY':
    ans += a
  else:
    ans += a * 380000.0
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0.0
for i in range(n):
  a, c = input().split()
  a = float(a)
  if c == 'JPY':
    ans += a
  else:
    ans += a * 380000.0
print(ans)
n=int(input())
p=[input() for i in range(n)]
print(sum(p)-max(p)/2)

### FIXED CODE ###

n=int(input())
p=[int(input()) for i in range(n)]

print(sum(p)-(max(p)//2))
n, l = map(int, raw_input().split())

for i in xrange(n):
  a.append(raw_input())
a.sort()
print "".join(a)

### FIXED CODE ###


n, l = map(int, raw_input().split())
a = []
for i in xrange(n):
  a.append(raw_input())
a.sort()
print "".join(a)
n = input()
from itertools import product
from collectins import Counter
sum = 0
for i in range(len(n)-2):
  for j in list(product("753", repeat=i+3)):
    if int(''.join(j)) <= int(n) and len(Counter(j))==3:
      sum+=1
print(sum)

### FIXED CODE ###

n = input()
from itertools import product
sum = 0
for i in range(len(n)-2):
  for j in list(product("753", repeat=i+3)):
    if int(''.join(j)) <= int(n) and len(set(j))==3:
      sum+=1
print(sum)
import sys
if __name__=="__main__":
    a, b = list(map(int, input().split(" ")))
    if(a > b):
	sys.stdout.write("Alice")
    elif(a == b):
	sys.stdout.write("Draw")
    else:
	sys.stdout.write("Bob")

### FIXED CODE ###

if __name__=="__main__":
    a, b = list(map(int, input().split(" ")))
    if(a==1):
        a = 14
    if(b==1):
        b = 14
    if(a > b):
        print("Alice")
    elif(a == b):
        print("Draw")
    else:
        print("Bob")
A,B=map(int,input().split())
C=A*B
if A<B :
    A,B=B,A
while a%b=0:
    A,B=B,A%B 
D=C/B
print(D)

### FIXED CODE ###

A,B=map(int,input().split())
C=A*B
if A<B :
    A,B=B,A
while A%B!=0:
    A,B=B,A%B 
D=C/B
print(int(D))
import numpy as np

N, Q=map(int, input().split())
matrix=np.zeros((N, N))
point=np.zeros(N)

for i in range(N-1):
  a, b=map(int, input().split())
  matrix[int(a-1), int(b-1)]=1
  
for i in range(Q):
  p, x=map(int, input().split())
  point[int(p-1)]+=x
  
for i in range(N-1):
  point+=matrix[int(i), :]*point[int(i)]
  
print(' '.join(map(str, map(int, point.tolist()))))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def input():
  return sys.stdin.readline()[:-1]

N, Q=map(int, input().split())

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

px=[list(map(int, input().split())) for i in range(Q)]

counter=[0]*(N+1)
for i in range(Q):
  counter[px[i][0]]+=px[i][1]
  
def f(num, prenum=-1, p=0):
  counter[num]+=p
  for postnum in link[num]:
    if postnum==prenum:
      continue
    f(postnum, num, counter[num])
    
f(1)

print(*counter[1:])
a, b = map(int, input().split())
print((a + b)/2)


### FIXED CODE ###

a, b = map(int, input().split())
print((a + b)//2)
from itertools import count
??
for i in count(1):
????????s = input()
??
????????if s == "0":
????????????????break
????????else:
????????????????print("Case {}: {}".format(i, s))

### FIXED CODE ###

from itertools import count

for i in count(1):
    s = input()

    if s == "0":
        break
    else:
        print("Case {}: {}".format(i, s))
N, T = map(int, input().split())
dic = {}
for i in range(N):
    c, t = [int(i) for i in input().split()]
    dic[t].append(c)
if max(dic) <= T:
    print(dic[max(dic)])
else:
    print('TLE')

### FIXED CODE ###

N, T = map(int, input().split())
costs = []
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        costs.append(c)
if len(costs) == 0:
    print('TLE')
else:
    print(min(costs))
N,M,X = map(int, input().split())
li = list(map(int, input().split()))
an1 = 0
an2 = 0
nu = 0
for i in range(1,X):
    if i == li[nu]:
        an1 += 1
        nu += 1
for i in range(X+1,N):
    if i == li[nu]:
        an2 += 1
        nu += 1
if an1 > an2:
    print(an2)
else:
    print(an1)

### FIXED CODE ###

N,M,X = map(int, input().split())
li = list(map(int, input().split()))
a = 0
nu = 0
for i in range(1,X):
    if i == li[nu]:
        a += 1
        nu += 1
    if nu == len(li):
        break
b = len(li) - a
if a > b:
    print(b)
else:
    print(a)
N=list(map(int,input()))
N.reverse()
N.append(0)
n=len(N)
pay=[0]*n
price = N.copy()

for i in range (n):
    if N[i]>5:
        pay[i]=0
        N[i+1]=N[i+1]+1
    elif  N[i]<5:
        pay[i]=N[i]
    else:
        if N[i+1]>=5:
            pay[i]=0
            N[i+1]=N[i+1]+1
        else:
            pay[i]=N[i]

sum_pay=sum(pay)

c=0
for i in range (n):
    if pay[i]-price[i]>=0:
        c=c+pay[i]-price[i]
    else:
        c=c+10+pay[i]-price[i]
        pay[i+1]=pay[i+1]-1

sum_otsuri=c

sum=sum_otsuri+sum_pay
print(sum)

### FIXED CODE ###

N=list(map(int,input()))
N.reverse()
N.append(0)
n=len(N)
pay=[0]*n
price = list(N)

for i in range (n):
    if N[i]>5:
        pay[i]=0
        N[i+1]=N[i+1]+1
    elif  N[i]<5:
        pay[i]=N[i]
    else:
        if N[i+1]>=5:
            pay[i]=0
            N[i+1]=N[i+1]+1
        else:
            pay[i]=N[i]


#print(price)
#print(pay)
sum_pay=sum(pay)

c=0
for i in range (n):
    if pay[i]-price[i]>=0:
        c=c+pay[i]-price[i]
    else:
        c=c+10+pay[i]-price[i]
        pay[i+1]=pay[i+1]-1

sum_otsuri=c

#print(sum_otsuri)
#print(sum_pay)

sum=sum_otsuri+sum_pay
print(sum)
import sys
args = sys.argv
a=int(args[1])
b=int(args[2])
print(a,b)

### FIXED CODE ###

s = input().split()
a=int(s[0])
b=int(s[1])
print(a*b,a*2+b*2)
import numpy as np
import math

v_min = math.inf

def solve(arr):
  global v_min
  count = 0
  for v in arr:
    if v <= v_min:
      count += 1
      v_min = v
  return count

if __name__ == "__main__":
  _n = int(input())
  arr = [int(i) for i in input().split()]
  ans = solve(arr)
  print(int(ans))


### FIXED CODE ###

import numpy as np
import math

v_min = np.inf

def solve(arr):
  global v_min
  count = 0
  for v in arr:
    if v <= v_min:
      count += 1
      v_min = v
  return count

if __name__ == "__main__":
  _n = int(input())
  arr = [int(i) for i in input().split()]
  ans = solve(arr)
  print(int(ans))
list = [i for i in input().split()]
print(' '.join([int(i) for i in sorted(list)]))

### FIXED CODE ###

L = [int(i) for i in input().split()]
print(' '.join([str(i) for i in sorted(L)]))
# どうやって自明な条件で計算量を落としていくか
# 不等式に注目。pythonが耐えるのは10^6程度
import numpy as np
X,Y,Z,K = map(int,input().split())
As = sorted(list(map(int,input().split())),reverse=True)
Bs = sorted(list(map(int,input().split())),reverse=True)
Cs = sorted(list(map(int,input().split())),reverse=True)

# ABでソート
AB = []
for A in As:
    for B in Bs:
        AB.append(A+B)
ABs = sorted(AB,reverse=True)

# その中からK番目まで
ABC = []
for i in range(min(len(ABs),K)):
    for C in Cs:
        ABC.append(ABs[i]+C)

ABCs = sorted(ABC,reverse=True)
for i in range(K):
    print(ABCs[i])

### FIXED CODE ###

# どうやって自明な条件で計算量を落としていくか
# 不等式に注目。pythonが耐えるのは10^6程度
X,Y,Z,K = map(int,input().split())
As = sorted(list(map(int,input().split())),reverse=True)
Bs = sorted(list(map(int,input().split())),reverse=True)
Cs = sorted(list(map(int,input().split())),reverse=True)

# ABでソート
AB = []
for A in As:
    for B in Bs:
        AB.append(A+B)
ABs = sorted(AB,reverse=True)

# その中からK番目まで
ABC = []
for i in range(min(len(ABs),K)):
    for C in Cs:
        ABC.append(ABs[i]+C)

ABCs = sorted(ABC,reverse=True)
for i in range(K):
    print(ABCs[i])
S=input()
Q=int(input())
lis=[]
for _ in range(Q):
    lis.append(input().split())
ans=S
cnt=0
for i in lis:
    if(int(i[0]) == 1):
        cnt= (cnt+1) % 2
    elif((cnt== 0 and i[1]=='1') or (cnt == 1 and i[1]=='2')):
        ans= i[2] + ans
    else:
        ans+=i[2]

print(ans[::-1]) if(cnt % 2 == 1) else print(ans)
print(time.time() - t)    

### FIXED CODE ###

from collections import deque
S=input()
Q=int(input())
ans=deque(S)
cnt=0
for _ in range(Q):
    i=(input().split())
    if(int(i[0]) == 1):
        cnt= (cnt+1) % 2
    elif((cnt== 0 and i[1]=='1') or (cnt == 1 and i[1]=='2')):
        ans.appendleft(i[2])
    else:
        ans.append(i[2])
ans=''.join(ans)
print(ans[::-1]) if(cnt % 2 == 1) else print(ans)
import sys

def wfs(queue, S, step, goal):
    next_queue = []
    for q in queue:
        if q == goal:
            return step+1

        i, j = q[0], q[1]
        S[i][j] = '#'

        if S[i+1][j] == '.':
            next_queue.append([i+1, j])
        if S[i-1][j] == '.':
            next_queue.append([i-1, j])
        if S[i][j+1] == '.':
            next_queue.append([i, j+1])
        if S[i][j-1] == '.':
            next_queue.append([i, j-1])

    if len(next_queue) == 0:
        return -1
    else:
        return wfs(next_queue, S, step+1, goal)


def main():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    S = []
    init = 0
    for _ in range(H):
        s = input().strip()
        init += s.count('#')
        S.append('#' + s + '#')
    S = ['#' * (W+2)] + S + ['#' * (W+2)]
    minstep = wfs([[1,1]], S, 0, [H, W])
    if minstep == -1:
        print(-1)
    else:
        print(H*W - minstep - init)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def wfs(queue, S, step, goal):
    next_queue = set()
    for q in queue:
        if q == goal:
            return step+1

        i, j = q[0], q[1]
        S[i][j] = '#'

        if S[i+1][j] == '.':
            next_queue.add((i+1, j))
        if S[i-1][j] == '.':
            next_queue.add((i-1, j))
        if S[i][j+1] == '.':
            next_queue.add((i, j+1))
        if S[i][j-1] == '.':
            next_queue.add((i, j-1))

    if len(next_queue) == 0:
        return -1
    else:
        next_queue = list(set(next_queue))
        return wfs(next_queue, S, step+1, goal)


def main():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    S = []
    black = 0
    for _ in range(H):
        s = [c for c in input().strip()]
        black += sum([c == '#' for c in s])
        S.append(['#'] + s + ['#'])
    S = [['#'] * (W+2)] + S + [['#'] * (W+2)]
    init = set([(1, 1)])
    minstep = wfs(init, S, 0, (H, W))
    if minstep == -1:
        print(-1)
    else:
        print(H*W - minstep - black)


if __name__ == '__main__':
    main()
import math
x=int(input())
serach_number = 100000


def sieve_of_eratosthenes(target, c):
    k=0
    dest = int(math.sqrt(target))
    target_list = list(range(2, target + 1))
    prime_list = []

    while True:
        num_min = min(target_list)
        if num_min >= dest:
            prime_list.extend(target_list)
            break
        prime_list.append(num_min)
        if num_min>=x:
            k=1
        if k==1:
            print(num_min)
            return
        i = 0

        while True:
            if i >= len(target_list):
                break
            elif target_list[i] % num_min == 0:
                target_list.pop(i)
            i += 1




sieve_of_eratosthenes(serach_number, c)


### FIXED CODE ###

import math
x=int(input())

serach_number = 100004

def sieve_of_eratosthenes(target, x):
    dest = int(math.sqrt(target))
    target_list = list(range(2, target + 1))
    prime_list = []

    while True:
        num_min = min(target_list)
        if num_min >= dest:
            prime_list.extend(target_list)
            break
        prime_list.append(num_min)


        i = 0

        while True:
            if i >= len(target_list):
                break
            elif target_list[i] % num_min == 0:
                target_list.pop(i)
            i += 1
    while True:
        if (x in prime_list) == True:
            print(x)
            break
        else:
            x +=1


sieve_of_eratosthenes(serach_number, x)
l=list(map(int,input().split()))
if !all[i<=9 for i in l]:
  print (-1)
else:
  print(l[0]*l[1])

### FIXED CODE ###

l=list(map(int,input().split()))
a=l[0]
b=l[1]
if(a<=9 and b<=9):
  print(a*b)
else:
  print(-1)