n=gets.to_i c=0 d=0 for _ in 2..n a,b=gets.split.map &:to_i c+=a;d+=b; end puts [c,d].min+1