n = int(input())
num = 0
for i in range(n):
    a, b = map(int, input().split())
    num = num + b - a + 1
print(num)

43cdcb22be16a789cba54b0ab3403572f6ece48b
<mask token>

<mask token>
for i in range(n):
    a, b = map(int, input().split())
    num = num + b - a + 1
print(num)

n = int(input())
num = 0
for i in range(n):
    a, b = map(int, input().split())
    num = num + b - a + 1
print(num)
