eq=input().split(' ')

class Stack():
	def __init__(self):
		self.S=[]
		self.top=-1
		
	def initialize(self):
		self.top=-1
	
	def isEmpty(self):
		if self.top==-1:
			return('Empty')
		else:
			return('Not Empty')
	
	def push(self,x):
		self.S.append(x)
		self.top+=1
	
	def pop(self):
		a=self.S[self.top]
		del self.S[self.top]
		self.top-=1
		return(a)
		
	
	
	
c=Stack()
for i in range(len(eq)):
	if eq[i].isdigit():
		c.push(eq[i])
	else:
		a=c.pop()
		b=c.pop()
		if eq[i]=='+':
			c.push(int(b)+int(a))
		elif eq[i]=='-':
			c.push(int(b)-int(a))
		else:
			c.push(int(b)*int(a))
			
print(c.pop()) eq=input().split(' ') eq input().split(' ') ().split () input split ' ' class Stack():
	def __init__(self):
		self.S=[]
		self.top=-1
		
	def initialize(self):
		self.top=-1
	
	def isEmpty(self):
		if self.top==-1:
			return('Empty')
		else:
			return('Not Empty')
	
	def push(self,x):
		self.S.append(x)
		self.top+=1
	
	def pop(self):
		a=self.S[self.top]
		del self.S[self.top]
		self.top-=1
		return(a)
		
	
	
	 Stack def __init__(self):
		self.S=[]
		self.top=-1
		
	 __init__ self.S=[] self.S self S [] self.top=-1 self.top self top -1 self self def initialize(self):
		self.top=-1
	
	 initialize self.top=-1 self.top self top -1 self self def isEmpty(self):
		if self.top==-1:
			return('Empty')
		else:
			return('Not Empty')
	
	 isEmpty if self.top==-1:
			return('Empty')
		else:
			return('Not Empty')
	
	 self.top==-1 self.top self top -1 return('Empty') 'Empty' return('Not Empty') 'Not Empty' self self def push(self,x):
		self.S.append(x)
		self.top+=1
	
	 push self.S.append(x) self.S.append self.S self S append x self.top+=1 self.top self top 1 self self x x def pop(self):
		a=self.S[self.top]
		del self.S[self.top]
		self.top-=1
		return(a)
		
	
	
	 pop a=self.S[self.top] a self.S[self.top] self.S self S self.top self top del self.S[self.top] self.S[self.top] self.S self S self.top self top self.top-=1 self.top self top 1 return(a) a self self c=Stack() c Stack() Stack for i in range(len(eq)):
	if eq[i].isdigit():
		c.push(eq[i])
	else:
		a=c.pop()
		b=c.pop()
		if eq[i]=='+':
			c.push(int(b)+int(a))
		elif eq[i]=='-':
			c.push(int(b)-int(a))
		else:
			c.push(int(b)*int(a))
			 i range(len(eq)) range len(eq) len eq if eq[i].isdigit():
		c.push(eq[i])
	else:
		a=c.pop()
		b=c.pop()
		if eq[i]=='+':
			c.push(int(b)+int(a))
		elif eq[i]=='-':
			c.push(int(b)-int(a))
		else:
			c.push(int(b)*int(a))
			 eq[i].isdigit() [i].isdigit [i] eq i isdigit c.push(eq[i]) c.push c push eq[i] eq i a=c.pop() a c.pop() c.pop c pop b=c.pop() b c.pop() c.pop c pop if eq[i]=='+':
			c.push(int(b)+int(a))
		elif eq[i]=='-':
			c.push(int(b)-int(a))
		else:
			c.push(int(b)*int(a))
			 eq[i]=='+' eq[i] eq i '+' c.push(int(b)+int(a)) c.push c push int(b)+int(a) int(b) int b int(a) int a elif eq[i]=='-':
			c.push(int(b)-int(a))
		 eq[i]=='-' eq[i] eq i '-' c.push(int(b)-int(a)) c.push c push int(b)-int(a) int(b) int b int(a) int a c.push(int(b)*int(a)) c.push c push int(b)*int(a) int(b) int b int(a) int a print(c.pop()) print c.pop() c.pop c pop eq=input().split(' ') input().split(' ') eq class Stack():
	def __init__(self):
		self.S=[]
		self.top=-1
		
	def initialize(self):
		self.top=-1
	
	def isEmpty(self):
		if self.top==-1:
			return('Empty')
		else:
			return('Not Empty')
	
	def push(self,x):
		self.S.append(x)
		self.top+=1
	
	def pop(self):
		a=self.S[self.top]
		del self.S[self.top]
		self.top-=1
		return(a)
		
	
	
	 class Stack():
	def __init__(self):
		self.S=[]
		self.top=-1
		
	def initialize(self):
		self.top=-1
	
	def isEmpty(self):
		if self.top==-1:
			return('Empty')
		else:
			return('Not Empty')
	
	def push(self,x):
		self.S.append(x)
		self.top+=1
	
	def pop(self):
		a=self.S[self.top]
		del self.S[self.top]
		self.top-=1
		return(a)
		
	
	
	 Stack a=c.pop() c.pop() a b=c.pop() c.pop() b c=Stack() Stack() c
eq=input().split(' ')

class Stack():
	def __init__(self):
		self.S=[]
		self.top=-1
		
	def initialize(self):
		self.top=-1
	
	def isEmpty(self):
		if self.top==-1:
			return('Empty')
		else:
			return('Not Empty')
	
	def push(self,x):
		self.S.append(x)
		self.top+=1
	
	def pop(self):
		a=self.S[self.top]
		del self.S[self.top]
		self.top-=1
		return(a)
		
	
	
	
c=Stack()
for i in range(len(eq)):
	if eq[i].isdigit():
		c.push(eq[i])
	else:
		a=c.pop()
		b=c.pop()
		if eq[i]=='+':
			c.push(int(b)+int(a))
		elif eq[i]=='-':
			c.push(int(b)-int(a))
		else:
			c.push(int(b)*int(a))
			
print(c.pop())
