#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  if (a.size() * b.size() == 1)
    cout << ((int)a[0] * (int)b[0]) << endl;
  else
    cout << -1 << endl;
}
