#include<bits/stdc++.h>
using namespace std;
#define maxn 100003
int l[maxn],r[maxn];
int main(){
int n,lsum=0,rsum=0,ans=0,id=0;
cin>>n;
for (int i=1;i<=n;i++){
cin>>l[i]>>r[i];
lsum+=l[i];
rsum+=r[i];
}
ans=abs(lsum-rsum);
for (int i=1;i<=n;i++){
lsum-=l[i];
rsum-=r[i];
lsum+=r[i];
rsum+=l[i];
if (abs(lsum-rsum)>ans){
ans=abs(lsum-rsum);
id=i;
}
lsum=lsum-r[i]+l[i];
rsum=rsum-l[i]+r[i];
}
cout<<id;
}