import sys
from collections import deque
E = list(sys.stdin.readline()[:-1]) #중위표기식
stack = []; result = ''
for e in E:
if e >= 'A' and e <= 'Z':
result += e
elif e == '(':
stack.append(e)
elif e == ')':
while stack:
if stack[-1] == '(':
break
else:
result += stack.pop()
stack.pop()
elif e == '*' or e == '/':
while stack and (stack[-1] == '*' or stack[-1] == '/'):
result += stack.pop()
stack.append(e)
elif e == '+' or e == '-':
while stack and (stack[-1] != '('):
result += stack.pop()
stack.append(e)
else:
continue
while stack:
result += stack.pop()
print(result)
아 어려움 난 빡대가리야