int main(){ int a[1000],p,s,t,m=0; scanf("%d",&s);t=s; for(;s--;a[s]+=p*4,m=a[s]>m?a[s]:m)scanf("%d%d",a+s,&p); for(s=p=0;s