#include #include #include #include using namespace std; int main(){ long int N,x,y,num; vector a,b; cin >> N; for(long int i=0;i> x >> y; if(y-x!=num||y-x<=0){ cout << "-1"; return 0; } num = y-x; } cout << num; return 0; }