module Main where

import Data.List as List
import qualified Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as BS
import Control.Monad as M
import Data.Maybe as Maybe

main :: IO ()
main =
    (\v -> solve v (v V.! 2) 10) =<< getInts

getInt :: IO Int
getInt = read <$> BS.unpack <$> BS.getLine

splitLine :: IO [BS.ByteString]
splitLine = BS.words <$> BS.getLine

getInts :: IO (V.Vector Int)
getInts = V.fromList <$> List.map fst <$> Maybe.mapMaybe BS.readInt <$> splitLine

{-
getInts :: IO (V.Vector Int)
getInts = V.fromList <$> List.map fst <$> Maybe.mapMaybe BS.readInt <$> replicateM 3 BS.getLine
-}

solve :: V.Vector Int -> Int -> Int -> IO ()
solve _ _ 0 = return ()
solve v x n = print nx >>= (\_ -> solve v nx (n - 1))
    where
        nx = x * (v V.! 0) - (v V.! 1)
