#include #include #include #include #include using namespace std; int main(){ int n; int ans; cin >> n; int x,y; cin >> x >>y; ans = y-x; for(int i=0;i> x >> y; if(y-x != ans){ ans=-1; break; } } if(ans<-1||ans==0)ans=-1; cout << ans <