import sys
import re
arr = sys.stdin.readline()
score = [0,0,0]
count = 0
p=re.compile('\d+[A-Z][*|#]*') # 정규식 만들기, 정수여러개, 영문자 하나, 특수문자 있거나 없거나
m=p.findall(arr)
z=0
while z<3:
for i in m:
for j in range(0,len(i)):
if i[j] =='1' and i[j+1]=='0': #첫번째랑 두번째 합쳐서 10이면
score[z] = 10
elif i[j] >='0' and i[j]<='9' and i[j-1]!='1':
score[z] = int(i[j]) #10이 아니면 정수로 변환
elif i[j] =='S':
score[z]*=1
elif i[j] =='D':
score[z]*=score[z]
elif i[j] =='T':
score[z]*=score[z]*score[z]
elif i[j] =='#':
score[z]*=-1
elif i[j]=='*' and z == 0:
count += 1
score[0]*=2
elif i[j]=='*' and z ==1 :
score[0]*=2
score[1]*=2
elif i[j]=='*' and z ==2 :
score[1]*=2
score[2]*=2
z+=1
print(score[0]+score[1]+score[2])