main = do
    contents <- getContents
    mapM_ print . map solve $ init $ lines contents

solve :: String -> Int
solve s
    | c == "+" = a + b
    | c == "-" = a - b
    | c == "*" = a * b
    | c == "/" = a `div` b
    where (a, c, b) = toExpression s
toExpression :: String -> (Int, String, Int)
toExpression = (\ws -> (read (head ws) :: Int, ws!!1, read (last ws) :: Int)) . words