module Main where
main = interact $ printer . solver . parser
int = read :: String -> Int

printer = unlines . (:[]) . show
parser = map (map int . words) . tail . lines

solver pairs = sum ns
  where
    ns = map (\[l,r] -> r-l+1) pairs
