func main() var ans: int :: 0 var s: []char :: cui@input() var n: int :: ^s var st: int :: 0 var minus: bool :: false var nest: bool :: false for i(0, ^s - 1) switch(s[i]) case '(' do nest :: true case ')' do nest :: false if(minus) do ans :- st else do ans :+ st end if do st :: 0 do minus :: false case '+' if(!nest) do minus :: false end if case '-' if(!nest) do minus :: true end if default if(!nest) if(i = 0 | s[i - 1] <> '-') do ans :+ s[i] $ int - '0' $ int else do ans :- s[i] $ int - '0' $ int end if else if(i = 0 | s[i - 1] <> '-') do st :+ s[i] $ int - '0' $ int else do st :- s[i] $ int - '0' $ int end if end if end switch end for do cui@print("\{ans}\n") end func