#include <bits/stdc++.h>
int main() {
  int a, b, t, m;
  std::cin >> a >> b;
  t = a * b;
  m = 1;
  if (a * b > 81) {
    std::cout << -1;
  } else if (a <= 9 and b <= 9)
    std::cout << a * b;
  else {
    for (int i = 9; i >= 2; i++) {
      if (t % i == 0) {
        m *= i;
        t /= i;
      }
      if (t <= 9 and m <= 9) {
        std::cout << a * b;
        return 0;
      }
    }
    std::cout << -1;
  }
}
