print((sum(1-eval(s.replace(' ','-'))for s in open(0).readlines()[1:])))
_,*t=open(0);print((sum(1-eval(s.replace(' ','-'))for s in t)))
print((sum(1 - eval(s.replace(" ", "-")) for s in open(0).readlines()[1:])))

_, *t = open(0)
print((sum(1 - eval(s.replace(" ", "-")) for s in t)))

-print((sum(1 - eval(s.replace(" ", "-")) for s in open(0).readlines()[1:]))) +_, *t = open(0) +print((sum(1 - eval(s.replace(" ", "-")) for s in t)))