main = getContents >>= putStr.formatOut.map calc.formatIn

-- ??\????????´??¢??¨
formatIn :: String -> [(Int, String, Int)]
formatIn =map ((\(x:y:z:_) -> (f x, y, f z)).words).takeWhile (notElem '?').lines
  where f = read :: String -> Int

-- ????????¨??´??¢??¨
formatOut :: [Int] -> String
formatOut = unlines.map show

-- ?¨??????¨
calc :: (Int, String, Int) -> Int
calc (x,y,z) = (f y) x z
  where f "+" = (+)
        f "-" = (-)
        f "*" = (*)
        f "/" = div