n = int(input()) l = [] ans=1 for i in range(n-1): a,b = list(map(int,input().split())) ans+=b print(ans)