main = do getLine getContents >>= print . (`mod` 1000000007) . sum . map ((\(c:d:_) -> (c+1) `div` 2 * d) . map (read::String->Integer) . words) . lines