import Control.Monad import Data.Maybe import qualified Data.ByteString.Char8 as B rInt :: B.ByteString -> Int rInt = fst . fromJust . B.readInt modm a = a `mod` 1000000007 productcd cds = modm (x * y) where x = modm $ div ((cds !! 0) + 1) 2 y = modm (cds !! 1) main = do n <- readLn xs <- map (productcd . (map rInt . B.words)) <$> replicateM n B.getLine print $ modm $ sum xs