#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

char buf[128];

int main() {
  while (fgets(buf,100,stdin)) {
    const int N = strlen(buf);
    char bbuf[100];
    int itr = 0;
    stack<double> s;
    while (sscanf(buf+itr,"%s",bbuf)) {
      const int M = strlen(bbuf);
      if (M == 1) {
        if (isdigit(bbuf[0])) {
          s.push(atoi(bbuf));
        } else {
          double rhs = s.top(); s.pop();
          double lhs = s.top(); s.pop();
          //printf("%.3lf : %.3lf\n", lhs, rhs);
          switch (bbuf[0]) {
          case '-':
            lhs -= rhs;
            break;
          case '+':
            lhs += rhs;
            break;
          case '*':
            lhs *= rhs;
            break;
          case '/':
            lhs /= rhs;
            break;
          }
          s.push(lhs);
        }
      } else {
        s.push(atoi(bbuf));
      }
      itr += M+1;
      if (itr >= N) break;
    }
    printf("%.lf\n", s.top());
  }
  return 0;
}
  