N = int(input()) ans = 0 for i in range(N - 1): A, B = map(int,input().split()) ans += B print(ans + 1)