class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1)

def calc(array):
    stack = Stack()
    for s in array:
        if s.isdigit():
            stack.push(int(s))
        else:
            o2 = stack.pop()
            o1 = stack.pop()
            ans = 0
            if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
            stack.push(ans)
    return stack.pop()


def main():
    in_arr = input().split()
    print(calc(in_arr))

if __name__ == '__main__':
    main() class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1) Stack def __init__(self):
        self.stack = []

     __init__ self.stack = [] self.stack self stack [] self self def push(self, value):
        self.stack.append(value)

     push self.stack.append(value) self.stack.append self.stack self stack append value self self value value def pop(self):
        return self.stack.pop(-1) pop return self.stack.pop(-1) self.stack.pop(-1) self.stack.pop self.stack self stack pop -1 self self def calc(array):
    stack = Stack()
    for s in array:
        if s.isdigit():
            stack.push(int(s))
        else:
            o2 = stack.pop()
            o1 = stack.pop()
            ans = 0
            if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
            stack.push(ans)
    return stack.pop() calc stack = Stack() stack Stack() Stack for s in array:
        if s.isdigit():
            stack.push(int(s))
        else:
            o2 = stack.pop()
            o1 = stack.pop()
            ans = 0
            if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
            stack.push(ans)
     s array if s.isdigit():
            stack.push(int(s))
        else:
            o2 = stack.pop()
            o1 = stack.pop()
            ans = 0
            if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
            stack.push(ans)
     s.isdigit() s.isdigit s isdigit stack.push(int(s)) stack.push stack push int(s) int s o2 = stack.pop() o2 stack.pop() stack.pop stack pop o1 = stack.pop() o1 stack.pop() stack.pop stack pop ans = 0 ans 0 if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
             s == '+' s '+' ans = o1 + o2 ans o1 + o2 o1 o2 elif s == '-':
                ans = o1 - o2
             s == '-' s '-' ans = o1 - o2 ans o1 - o2 o1 o2 elif s == '*':
                ans = o1 * o2
             s == '*' s '*' ans = o1 * o2 ans o1 * o2 o1 o2 elif s == '/':
                ans = o1 / o2
             s == '/' s '/' ans = o1 / o2 ans o1 / o2 o1 o2 stack.push(ans) stack.push stack push ans return stack.pop() stack.pop() stack.pop stack pop array array def main():
    in_arr = input().split()
    print(calc(in_arr)) main in_arr = input().split() in_arr input().split() ().split () input split print(calc(in_arr)) print calc(in_arr) calc in_arr if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def calc(array):
    stack = Stack()
    for s in array:
        if s.isdigit():
            stack.push(int(s))
        else:
            o2 = stack.pop()
            o1 = stack.pop()
            ans = 0
            if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
            stack.push(ans)
    return stack.pop() def calc(array):
    stack = Stack()
    for s in array:
        if s.isdigit():
            stack.push(int(s))
        else:
            o2 = stack.pop()
            o1 = stack.pop()
            ans = 0
            if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
            stack.push(ans)
    return stack.pop() calc def main():
    in_arr = input().split()
    print(calc(in_arr)) def main():
    in_arr = input().split()
    print(calc(in_arr)) main class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1) class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1) Stack
class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1)

def calc(array):
    stack = Stack()
    for s in array:
        if s.isdigit():
            stack.push(int(s))
        else:
            o2 = stack.pop()
            o1 = stack.pop()
            ans = 0
            if s == '+':
                ans = o1 + o2
            elif s == '-':
                ans = o1 - o2
            elif s == '*':
                ans = o1 * o2
            elif s == '/':
                ans = o1 / o2
            stack.push(ans)
    return stack.pop()


def main():
    in_arr = input().split()
    print(calc(in_arr))

if __name__ == '__main__':
    main()