import           Control.Monad

main :: IO ()
main = do
    n <- readLn :: IO Int
    ns <- replicateM (n - 1) $ do
        [c, s, f] <- getInts
        return (c, (s, f))
    mapM_ print $ solve ns

getInts :: IO [Int]
getInts = map read . words <$> getLine

solve cs = loop cs
    where
      loop []     = [0]
      loop (x:xs) = go (fst (snd x) + fst x) xs : loop xs
      go acc [] = acc
      go acc (x:xs)
          | acc <= s = go (s + c) xs
          | acc `mod` f == 0 = go (acc + c) xs
          | otherwise = let m = (f - (acc `mod` f)) in
                go (acc + m + c) xs
        where
          (c, (s, f)) = x

