#!/usr/bin/python3 input() # Počet operací nepotřebujeme tokens = input().split(" ") stack = [] for token in tokens: if token == '+': y, x = stack.pop(), stack.pop() stack.append(x+y) elif token == '-': y, x = stack.pop(), stack.pop() stack.append(x-y) elif token == '*': y, x = stack.pop(), stack.pop() stack.append(x*y) elif token == '/': y, x = stack.pop(), stack.pop() stack.append(x//y) else: stack.append(int(token)) print(stack[0])