#include <bits/stdc++.h>
using namespace std;
const long long INFLL = 1e18;
const int MAXN = 3e5;
const long long INF = 1e9;
const long long kek = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  vector<int> c(401, 0);
  for (int i = 1; i < 10; i++) {
    for (int j = 0; j < (10); j++) c[i * j] = 1;
  }
  if (c[a * b] == 1)
    cout << a * b;
  else
    cout << -1;
}
