#include using namespace std; int main() { int A, B; cin >> A >> B; cout << ((__gcd(A, B) == 1) ? (--A * --B) / 2 : -1) << "\n"; }