import Control.Monad main = do n <- readLn cds <- replicateM n (liftM (map read . words) getLine) let s = sum . map (\[c, d] -> (c+1) `div` 2 * d) $ cds in print s