for i in range(input()): x,y=map(int,raw_input().split()) if(i and v!=y-x)+(y