def add(a, b):
    return b+a
def sub(a, b):
    return b-a
def mul(a, b):
    return b*a
def div(a, b):
    if a!=0:
        return b/a
    else:
        return 10000
operators = {'+':add, '-':sub, '*':mul, '/':div}

def calc_PRN(symbols):
    stack = []
    for s in symbols:
        if s in operators.keys():
            stack.append(operators[s](stack.pop(), stack.pop()))
        else:
            stack.append(int(s))
    return stack[-1]


if __name__ == '__main__':
    symbols = input().split()
    print(int(calc_PRN(symbols))) def add(a, b):
    return b+a add return b+a b+a b a a a b b def sub(a, b):
    return b-a sub return b-a b-a b a a a b b def mul(a, b):
    return b*a mul return b*a b*a b a a a b b def div(a, b):
    if a!=0:
        return b/a
    else:
        return 10000 div if a!=0:
        return b/a
    else:
        return 10000 a!=0 a 0 return b/a b/a b a return 10000 10000 a a b b operators = {'+':add, '-':sub, '*':mul, '/':div} operators {'+':add, '-':sub, '*':mul, '/':div} '+' '+' add '-' '-' sub '*' '*' mul '/' '/' div def calc_PRN(symbols):
    stack = []
    for s in symbols:
        if s in operators.keys():
            stack.append(operators[s](stack.pop(), stack.pop()))
        else:
            stack.append(int(s))
    return stack[-1] calc_PRN stack = [] stack [] for s in symbols:
        if s in operators.keys():
            stack.append(operators[s](stack.pop(), stack.pop()))
        else:
            stack.append(int(s))
     s symbols if s in operators.keys():
            stack.append(operators[s](stack.pop(), stack.pop()))
        else:
            stack.append(int(s))
     s in operators.keys() s operators.keys() operators.keys operators keys stack.append(operators[s](stack.pop(), stack.pop())) stack.append stack append operators[s](stack.pop(), stack.pop()) [s] operators s stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop stack.append(int(s)) stack.append stack append int(s) int s return stack[-1] stack[-1] stack -1 symbols symbols if __name__ == '__main__':
    symbols = input().split()
    print(int(calc_PRN(symbols))) __name__ == '__main__' __name__ '__main__' symbols = input().split() symbols input().split() ().split () input split print(int(calc_PRN(symbols))) print int(calc_PRN(symbols)) int calc_PRN(symbols) calc_PRN symbols def add(a, b):
    return b+a def add(a, b):
    return b+a add def div(a, b):
    if a!=0:
        return b/a
    else:
        return 10000 def div(a, b):
    if a!=0:
        return b/a
    else:
        return 10000 div symbols = input().split() input().split() symbols def sub(a, b):
    return b-a def sub(a, b):
    return b-a sub def mul(a, b):
    return b*a def mul(a, b):
    return b*a mul operators = {'+':add, '-':sub, '*':mul, '/':div} {'+':add, '-':sub, '*':mul, '/':div} operators def calc_PRN(symbols):
    stack = []
    for s in symbols:
        if s in operators.keys():
            stack.append(operators[s](stack.pop(), stack.pop()))
        else:
            stack.append(int(s))
    return stack[-1] def calc_PRN(symbols):
    stack = []
    for s in symbols:
        if s in operators.keys():
            stack.append(operators[s](stack.pop(), stack.pop()))
        else:
            stack.append(int(s))
    return stack[-1] calc_PRN
def add(a, b):
    return b+a
def sub(a, b):
    return b-a
def mul(a, b):
    return b*a
def div(a, b):
    if a!=0:
        return b/a
    else:
        return 10000
operators = {'+':add, '-':sub, '*':mul, '/':div}

def calc_PRN(symbols):
    stack = []
    for s in symbols:
        if s in operators.keys():
            stack.append(operators[s](stack.pop(), stack.pop()))
        else:
            stack.append(int(s))
    return stack[-1]


if __name__ == '__main__':
    symbols = input().split()
    print(int(calc_PRN(symbols)))