
main = 
    interact (calc . words)


calc :: [String] -> String
calc (a:op:b:xs)
    | op == "+" = (show $ round (x + y)) ++ "\n" ++ calc xs
    | op == "-" = (show $ round (x - y)) ++ "\n" ++ calc xs
    | op == "*" = (show $ round (x * y)) ++ "\n" ++ calc xs
    | op == "/" = (show $ floor (x / y)) ++ "\n" ++ calc xs
    | otherwise = ""
    where
        x = read a
        y = read b
