#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int a, b;
  bool ans = false;
  cin >> a >> b;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (a * b == i * j) {
        ans = true;
      }
    }
  }
  if (ans) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
}
