#include <bits/stdc++.h>
using namespace std;
int n;
double d(int x1, int y1, int x2, int y2) {
  return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
int fact(int i) {
  if (i == 1) return 1;
  return i * fact(i - 1);
}
int main() {
  vector<int> v;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      v.push_back(i * j);
    }
  }
  int a, b;
  cin >> a >> b;
  for (auto it : v) {
    if (it == a * b) {
      cout << a * b << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}
