main = getLine >> getContents >>= print . (`mod` 1000000007) . solve . lines solve :: [String] -> Integer solve = foldl (\acc x -> calc x + acc) 0 where calc x = (div (head $ reads x) 2 + mod (head $ reads x) 2) * (last $ reads x) reads = map read . words