#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>N; FOR(i,N) { cin>>x>>y; A[i]=x+y*4; ma=max(1LL*A[i],ma); } FOR(i,N) { if((ma-A[i])&1) return _P("-1\n"); tot += (ma-A[i])/2; } cout<