#include using namespace std; int main(){ int N,a,b; cin>>N; int res[N]; for(int i=0;i>a>>b; res[i]=b-a; if(i != 0 && res[i] !=res[i-1]){ cout<<-1<