fun readStr () = let fun scan reader stream = SOME (StringCvt.splitl (not o Char.isSpace) reader (StringCvt.skipWS reader stream)) in valOf (TextIO.scanStream scan TextIO.stdIn) end fun intString n = if 0 <= n then Int.toString n else "-" ^ Int.toString (abs n) fun findOpIndex i (#"+" :: _) = i | findOpIndex i (#"-" :: _) = i | findOpIndex i (_ :: rest) = findOpIndex (i + 1) rest val () = let val s = readStr () val opIndex = findOpIndex 1 (List.tl (String.explode s)) val x = valOf (Int.fromString (String.substring (s, 0, opIndex))) val y = valOf (Int.fromString (String.extract (s, opIndex + 1, NONE))) val opChar = String.sub (s, opIndex) val ans = if opChar = #"+" then x - y else x + y in print (intString ans ^ "\n") end