#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int A;
  int B;
  cin >> A >> B;
  int search = A * B;
  bool done = false;
  for (int i = 1; i < 10 && !done; i++) {
    if (search % i == 0 && (search / i) <= 9) {
      done = true;
    }
  }
  if (done) {
    cout << search << "\n";
  } else {
    cout << "-1\n";
  }
  return 0;
}
