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