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