x[1010],i;long long m,t,r;main(a,b){for(gets(&b);~scanf("%d%d",&a,&b);x[i++]=t=a+4*b,m=m