#include using namespace std; #define INF 1000000007 #define LINF (1LL << 60) typedef long long i64; typedef pair P; inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; } templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> a >> b; if(__gcd(a,b) != 1){ cout << -1 << endl; return; } cout << (a-1)*(b-1)/2 << endl; } int main(){ std::cin.tie(0); std::ios::sync_with_stdio(false); int t = 1; //cin >> t; while(t--){ solve(); } return 0; }