import strutils, sequtils, future, algorithm var s=stdin.readLine res=0 stack=newSeq[char]() for i in countdown(s.len-1, 0): if s[i]=='(': var ret=stack.pop.ord-'0'.ord c=stack.pop while c!=')': if c=='+': ret+=stack.pop.ord-'0'.ord else: ret-=stack.pop.ord-'0'.ord c=stack.pop stack.add((ret+'0'.ord).chr) else: stack.add(s[i]) reverse(stack) res=stack[0].ord-'0'.ord for i in 1..