#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  std::ios::sync_with_stdio(false);
  long long a, b, mult;
  cin >> a >> b;
  mult = a * b;
  for (long long i = 1; i <= 9; ++i)
    for (long long j = 1; j <= 9; ++j)
      if (i * j == mult) {
        cout << mult << '\n';
        return 0;
      }
  cout << "-1\n";
  return 0;
}
