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