n = int(input()) admisssion = 0 out = 0 for _ in range(n-2+1): a, b = map(int,input().split()) admisssion += a out += b if admisssion >= out: #Aが0のとき minimA1 = 0 minimB1 = admisssion - out #Bが最大の時 maximA1 = out maximB1 = admisssion print(maximB1-minimB1+1) else: print(1)