#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    unordered_map<ll,ll>mp;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            mp[i*j]++;
        }
    }
    ll a,b;
    cin>>a>>b;
    if(mp.find(a*b)!=mp.end())
    {
        cout<<a*b<<endl;
    }
    else 
    {
        cout<<"-1";
    }
}