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