#include <bits/stdc++.h>
using namespace std;
void scan() {}
int vis[10000];
int solve(int T) {
  int n, m;
  cin >> n >> m;
  if (vis[n * m])
    cout << n * m << endl;
  else
    cout << -1 << endl;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      vis[i * j]++;
    }
  }
  int T = 1;
  for (int i = 1; i <= T; i++) solve(i);
  return 0;
}
