import Control.Monad main = do n <- readLn :: IO Int cs <- map (map read . words) <$> replicateM n getLine :: IO [[Int]] putStrLn . show $ sum $ map fn cs where fn [x, y] = if even x then x `div` 2 * y else (x `div` 2 + 1) * y