def push(S, top, x):
      S.append(x)
      top = top + 1

def pop(S, top):
      t = int(S[top-1])
      del S[top-1]
      top = top -1
      return t

if __name__ == "__main__":
      top = 0
      inpt = (input()).split()
      n = len(inpt)
      S = []
      for i in range(0,n):
            if inpt[i] == "+":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a + b
                  push(S, top, c)
            elif inpt[i] == "-":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a - b
                  push(S, top, c)
            elif inpt[i] == "*":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a * b
                  push(S, top, c)
            else :
                  push(S, top, int(inpt[i]))
      print(S[top-1]) def push(S, top, x):
      S.append(x)
      top = top + 1 push S.append(x) S.append S append x top = top + 1 top top + 1 top 1 S S top top x x def pop(S, top):
      t = int(S[top-1])
      del S[top-1]
      top = top -1
      return t pop t = int(S[top-1]) t int(S[top-1]) int S[top-1] S top-1 top 1 del S[top-1] S[top-1] S top-1 top 1 top = top -1 top top -1 top 1 return t t S S top top if __name__ == "__main__":
      top = 0
      inpt = (input()).split()
      n = len(inpt)
      S = []
      for i in range(0,n):
            if inpt[i] == "+":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a + b
                  push(S, top, c)
            elif inpt[i] == "-":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a - b
                  push(S, top, c)
            elif inpt[i] == "*":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a * b
                  push(S, top, c)
            else :
                  push(S, top, int(inpt[i]))
      print(S[top-1]) __name__ == "__main__" __name__ "__main__" top = 0 top 0 inpt = (input()).split() inpt (input()).split() input()).split input() input split n = len(inpt) n len(inpt) len inpt S = [] S [] for i in range(0,n):
            if inpt[i] == "+":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a + b
                  push(S, top, c)
            elif inpt[i] == "-":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a - b
                  push(S, top, c)
            elif inpt[i] == "*":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a * b
                  push(S, top, c)
            else :
                  push(S, top, int(inpt[i]))
       i range(0,n) range 0 n if inpt[i] == "+":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a + b
                  push(S, top, c)
            elif inpt[i] == "-":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a - b
                  push(S, top, c)
            elif inpt[i] == "*":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a * b
                  push(S, top, c)
            else :
                  push(S, top, int(inpt[i]))
       inpt[i] == "+" inpt[i] inpt i "+" b = pop(S, top) b pop(S, top) pop S top a = pop(S, top) a pop(S, top) pop S top c = a + b c a + b a b push(S, top, c) push S top c elif inpt[i] == "-":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a - b
                  push(S, top, c)
             inpt[i] == "-" inpt[i] inpt i "-" b = pop(S, top) b pop(S, top) pop S top a = pop(S, top) a pop(S, top) pop S top c = a - b c a - b a b push(S, top, c) push S top c elif inpt[i] == "*":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a * b
                  push(S, top, c)
             inpt[i] == "*" inpt[i] inpt i "*" b = pop(S, top) b pop(S, top) pop S top a = pop(S, top) a pop(S, top) pop S top c = a * b c a * b a b push(S, top, c) push S top c push(S, top, int(inpt[i])) push S top int(inpt[i]) int inpt[i] inpt i print(S[top-1]) print S[top-1] S top-1 top 1 a = pop(S, top) pop(S, top) a S = [] [] S n = len(inpt) len(inpt) n c = a * b a * b c b = pop(S, top) pop(S, top) b def pop(S, top):
      t = int(S[top-1])
      del S[top-1]
      top = top -1
      return t def pop(S, top):
      t = int(S[top-1])
      del S[top-1]
      top = top -1
      return t pop def push(S, top, x):
      S.append(x)
      top = top + 1 def push(S, top, x):
      S.append(x)
      top = top + 1 push inpt = (input()).split() (input()).split() inpt c = a - b a - b c c = a + b a + b c top = 0 0 top a = pop(S, top) pop(S, top) a b = pop(S, top) pop(S, top) b a = pop(S, top) pop(S, top) a b = pop(S, top) pop(S, top) b
def push(S, top, x):
      S.append(x)
      top = top + 1

def pop(S, top):
      t = int(S[top-1])
      del S[top-1]
      top = top -1
      return t

if __name__ == "__main__":
      top = 0
      inpt = (input()).split()
      n = len(inpt)
      S = []
      for i in range(0,n):
            if inpt[i] == "+":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a + b
                  push(S, top, c)
            elif inpt[i] == "-":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a - b
                  push(S, top, c)
            elif inpt[i] == "*":
                  b = pop(S, top)
                  a = pop(S, top)
                  c = a * b
                  push(S, top, c)
            else :
                  push(S, top, int(inpt[i]))
      print(S[top-1])