# 我的解法不能满足特殊情况,比如题目中的-4/(8-6)
# 针对表达式3+2*{1+2*[-4/(8-6)+7]},我的代码输出是3 2 1 2 4 8 6 - / - 7 + * + * +,这个情况就是错误的,多了一个操作符,对这个-4没法处理,有没有大神指点下啊
'''class Stack():
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peak(self):
return self.items[len(self.items) -1]
def size(self):
return len(self.items)
inflix = []
tokenList = list(input())
postfixList = []
opStack = Stack()
prec = {}
prec['*'] = 3
prec['/'] = 3
prec['+'] = 2
prec['-'] = 2
prec['('] = 1
prec['{'] = 1 #记录操作符的优先级
for token in tokenList:
if token in "01234567889":
postfixList.append(token)
elif token == '{':
opStack.push(token)
elif token == '}':
topToken = opStack.pop()
while topToken != '{':
postfixList.append(topToken)
topToken = opStack.pop()
elif token == '(':
opStack.push(token)
elif token == ')':
topToken = opStack.pop()
while topToken != ')':
postfixList.append(topToken)
topToken = opStack.pop()
else:
while (not opStack.isEmpty()) and (prec[opStack.peak()] >= prec[token]):
postfixList.append(opStack.pop())
opStack.push(token)
while not opStack.isEmpth():
postfixList.append(opStack.pop())
postfixList = ' '.join(postfixList)'''
# 大神的解法,直接用python内置的eval函数
s = input()
s = s.replace("{", "(")
s = s.replace("}", ")")
s = s.replace("[", "(")
s = s.replace("]", ")")
print(int(eval(s)))