# 1662번. 압축
s=input()stack=[]b=[0foriinrange(len(s))]foriinrange(len(s)):# 전처리
ifs[i]=='(':stack.append(i)elifs[i]==')':b[stack.pop()]=idefrecur(left,right):result=0whileleft<right:ifs[left].isdigit():# 괄호 안 숫자
result+=1left+=1else:result-=1# K를 빼줌
result+=int(s[left-1])*recur(left+1,b[left])left=b[left]+1returnresultprint(recur(0,len(s)))