import Control.Applicative import Data.List calc :: IO(Integer) -> IO([Integer]) -> IO(Integer) calc acc io = do a <- acc [c,d] <- io return $ (a+(c+1)`div`2*d)`mod`1000000007 main :: IO() main = do n <- (read::String->Int) <$> getLine let l = replicate n ((fmap (read::String->Integer) . words) <$> getLine) print =<< foldl' calc (return 0) l