#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int k = n * m;
  for (int i = 1; i <= 9; i++)
    for (int j = 1; j <= 9; j++) {
      int t = i * j;
      if (t == k) return cout << t, 0;
    }
  cout << "-1";
}
