#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e16;
const long long MAX_N = 100010;
int main() {
  long long a, b;
  cin >> a >> b;
  for (long long i = 1; i <= 9; i++) {
    for (long long j = 1; j <= 9; j++) {
      if (i * j == a * b) {
        cout << a * b << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}
