#include <bits/stdc++.h>
int main() {
  int A, B;
  scanf("%d %d", &A, &B);
  for (int i = 1; i <= 9; ++i)
    for (int j = 1; j <= 9; ++j)
      if (i * j == A * B) return !printf("%d\n", i * j);
  puts("-1");
}
