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