from re import*
exec(sub("&","','",sub("@","sub('",'''n=[];f=[]
def z():
global n,f
n,f=f,n
return 0
def r(x):
a=0
x=@"&\\"',x)
while n and n[-1]:a+=eval(x)
return a
exec(@[>\]]&)',@}&")',@{&+r("',@\[&-(',@<&+0*(',@\[]&+len(n)',@{}&+(len(n)and n.pop())',@<>&+z()',@\(&+(lambda x:n.append(x)or x)(',@\(\)&+1',raw_input())))))))))))''')))
print n