// -*- coding:utf-8; tab-width:4 -*-
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

// ティツァツ」テァツュツ?
namespace solution {
    using namespace std;
   
    typedef istringstream ISS;
    typedef ostringstream OSS;
    typedef vector<string> VS;
    typedef int LL;
    typedef LL INT;
    typedef vector<INT> VI;
    typedef vector<VI> VVI;
    typedef pair<INT, INT> II;

    string s;

    struct Solution {
        void init() {
            s = "";
        }

        bool input_line() {
            string line;
            if ( ! ( cin >> line ) )
                return false;
            if ( line == "=" )
                return false;
            s += line;
            return true;
        }
   
        bool input() {
            if ( ! input_line() )
                return false;
            while ( input_line() );
            return true;
        }

        template <class T>
        void erase( vector<T>& a, int k ) {
            a.erase( a.begin() + k );
        }

        int to_int( string s ) {
            ISS iss(s);
            int res;
            iss >> res;
            return res;
        } 

        void replace( string& s, char a, char b ) {
            std::replace( s.begin(), s.end(), a, b );
        }

        VI get_numbers( string s ) {
            string t = "+-*/";
            for ( string::iterator it_i = t.begin(); it_i != t.end(); ++ it_i ) 
                replace( s, *it_i, ' ' );
            ISS iss(s);
            VI res;
            int k;
            while ( iss >> k )
                res.push_back(k);
            return res;
        }

        VS get_operators( string s ) {
            for ( char c = '0'; c <= '9'; ++ c )
                replace( s, c, ' ' );
            ISS iss(s);
            VS res;
            string k;
            while ( iss >> k )
                res.push_back(k);
            return res;
        } 

        int eval() {
            VI A = get_numbers(s);
            VS B = get_operators(s);
            int n = A.size();

            for ( int i = 0; A.size() > 1; ) {
                if ( B[i] == "*" ) {
                    A[i+1] = A[i] * A[i+1];
                } else if ( B[i] == "/" ) {
                    A[i+1] = A[i] / A[i+1];
                } else if ( B[i] == "+" ) {
                    A[i+1] = A[i] + A[i+1];
                } else if ( B[i] == "-" ) {
                    A[i+1] = A[i] - A[i+1];
                } 
                erase( A, i );
                erase( B, i );
            }

            return A[0];
        }

        int solve() {
            return eval();
        }


        void output( int result ) {
            cout << result << endl;
        }
      
        int run() {
            while ( init(), input() ) {
                output(solve());
            }
            return 0;
        }
    };
}

int main() {
    return solution::Solution().run();
}

Measured memory_bytes: 1256