#coding: utf-8 ##yuki_178 import sys st_max=0 st_min=sys.maxint n=int(raw_input()) for i in xrange(n): a,b=map(int,raw_input().split()) st=a+b*4 if st>st_max: st_max=st if st