#include <bits/stdc++.h>

using namespace std;

int main() {
    char str[1000];
    map<char, int> priority = {
            {'\0', 0},
            {'+',  1},
            {'-',  1},
            {'*',  2},
            {'/',  2}
    };
    while (scanf("%s", str) != EOF) {
        string numStr = "";
        stack<double> numStack;
        stack<char> opStack;
        for (int i = 0;; ++i) {
            if (str[i] >= '0' && str[i] <= '9') {
                numStr.push_back(str[i]);
            } else {
                double num = stod(numStr);
                numStr = "";
                numStack.push(num);

                while (!opStack.empty() &&
                       priority[str[i]] <= priority[opStack.top()]) {
                    double rhs = numStack.top();
                    numStack.pop();
                    double lhs = numStack.top();
                    numStack.pop();
                    char curOp = opStack.top();
                    opStack.pop();

                    if (curOp == '+') {
                        numStack.push(lhs + rhs);
                    } else if (curOp == '-') {
                        numStack.push(lhs - rhs);
                    } else if (curOp == '*') {
                        numStack.push(lhs * rhs);
                    } else if (curOp == '/') {
                        numStack.push(lhs / rhs);
                    }
                }

                //栈为空或者新运算符优先级更高
                if (str[i] == '\0') {
                    printf("%d\n", (int) numStack.top());
                    break;
                } else {
                    opStack.push(str[i]);
                }
            }
        }
    }
    return 0;
}