import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

train :: [Int] -> Int -> Int
train [c, s, f] start = c + head (dropWhile (< start) [s, s + f ..])
train _ _ = 0

time :: [[Int]] -> Int
time [] = 0
time xs = foldl (flip train) (head xs !! 1) xs

main :: IO ()
main = do
    n <- fst . fromJust . B.readInt <$> B.getLine
    ts <- replicateM (n - 1) $ map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    putStr $ unlines $ map (show . time) (tails ts)
