import sys
input = sys.stdin.readline

A=int(input())
B=int(input())

bool1 =False
number=-1

if A*B>81:
    bool1=False
elif A*B<=81:
    for j in range(1,10):
        if A*B%j==0:
            if A*B/j<=9:
                bool1=True
                break

if bool1==True:
    print(A*B)
if bool1==False:
    print(-1)