#include <bits/stdc++.h>
using namespace std;
static const int INF = 1e9;
static const int MOD = 1000000007;
int main() {
  int a, b;
  cin >> a >> b;
  int ans = a * b;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i * j == ans) {
        cout << ans << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
}
