#!/usr/bin/env python                                                                                                                   
inputlist = map(str,raw_input().split())
numberlist = []
for a in inputlist:
    if a == "+":
        b = numberlist[-2]
	c = numberlist[-1]
	numberlist[-2:]=[]
	d = int(b) + int(c)
	numberlist.append(d)
    elif a == "-":
        b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) - int(c)
        numberlist.append(d)
    elif a == "*":
	b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) * int(c)
	numberlist.append(d)
    else:
        numberlist.append(a)
print(numberlist[0]) inputlist = map(str,raw_input().split()) inputlist map(str,raw_input().split()) map str raw_input().split() ().split () raw_input split numberlist = [] numberlist [] for a in inputlist:
    if a == "+":
        b = numberlist[-2]
	c = numberlist[-1]
	numberlist[-2:]=[]
	d = int(b) + int(c)
	numberlist.append(d)
    elif a == "-":
        b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) - int(c)
        numberlist.append(d)
    elif a == "*":
	b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) * int(c)
	numberlist.append(d)
    else:
        numberlist.append(a) a inputlist if a == "+":
        b = numberlist[-2]
	c = numberlist[-1]
	numberlist[-2:]=[]
	d = int(b) + int(c)
	numberlist.append(d)
    elif a == "-":
        b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) - int(c)
        numberlist.append(d)
    elif a == "*":
	b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) * int(c)
	numberlist.append(d)
    else:
        numberlist.append(a) a == "+" a "+" b = numberlist[-2] b numberlist[-2] numberlist -2 c = numberlist[-1] c numberlist[-1] numberlist -1 numberlist[-2:]=[] numberlist[-2:] numberlist -2: -2 [] d = int(b) + int(c) d int(b) + int(c) int(b) int b int(c) int c numberlist.append(d) numberlist.append numberlist append d elif a == "-":
        b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) - int(c)
        numberlist.append(d)
     a == "-" a "-" b = numberlist[-2] b numberlist[-2] numberlist -2 c = numberlist[-1] c numberlist[-1] numberlist -1 numberlist[-2:]=[] numberlist[-2:] numberlist -2: -2 [] d = int(b) - int(c) d int(b) - int(c) int(b) int b int(c) int c numberlist.append(d) numberlist.append numberlist append d elif a == "*":
	b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) * int(c)
	numberlist.append(d)
     a == "*" a "*" b = numberlist[-2] b numberlist[-2] numberlist -2 c = numberlist[-1] c numberlist[-1] numberlist -1 numberlist[-2:]=[] numberlist[-2:] numberlist -2: -2 [] d = int(b) * int(c) d int(b) * int(c) int(b) int b int(c) int c numberlist.append(d) numberlist.append numberlist append d numberlist.append(a) numberlist.append numberlist append a print(numberlist[0]) print numberlist[0] numberlist 0 c = numberlist[-1] numberlist[-1] c b = numberlist[-2] numberlist[-2] b c = numberlist[-1] numberlist[-1] c d = int(b) * int(c) int(b) * int(c) d numberlist = [] [] numberlist b = numberlist[-2] numberlist[-2] b d = int(b) - int(c) int(b) - int(c) d b = numberlist[-2] numberlist[-2] b inputlist = map(str,raw_input().split()) map(str,raw_input().split()) inputlist d = int(b) + int(c) int(b) + int(c) d c = numberlist[-1] numberlist[-1] c
#!/usr/bin/env python                                                                                                                   
inputlist = map(str,raw_input().split())
numberlist = []
for a in inputlist:
    if a == "+":
        b = numberlist[-2]
	c = numberlist[-1]
	numberlist[-2:]=[]
	d = int(b) + int(c)
	numberlist.append(d)
    elif a == "-":
        b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) - int(c)
        numberlist.append(d)
    elif a == "*":
	b = numberlist[-2]
        c = numberlist[-1]
        numberlist[-2:]=[]
        d = int(b) * int(c)
	numberlist.append(d)
    else:
        numberlist.append(a)
print(numberlist[0])