inp = list(map(int,input().split()))
a  = inp[0]
b = inp[1]
n = a*b
arr = []
hello = 0
for i in range(1,10):
  for x in range (1,10):
    arr.append(i*x)
for element in arr:
  if element == n:
    hello = 0
    break
  else:
    hello = 1
if hello == 1:
  print(-1)
else:
  print(n)
