#include <iostream>
#include <string>
#include <memory>
#include <list>
#include <sstream>
using namespace std;

class token {
public:
    virtual bool is_int() { return false; }
    virtual bool is_plus() { return false; }
    virtual bool is_star() { return false; }
    virtual bool is_leftP() { return false; }
    virtual bool is_rightP() { return false; }
    virtual int get_int_val() { throw - 1; }
};

class t_plus : public token {
public:
    bool is_plus() {
        return true;
    }
};

class t_star : public token {
public:
    bool is_star() {
        return true;
    }
};

class t_int : public token {
public:
    t_int(int val) : val(val) {}

    bool is_int() {
        return true;
    }

    int get_int_val() {
        return val;
    }
private:
    int val;

};

class t_leftP : public token {
public:
    bool is_leftP() {
        return true;
    }
};

class t_rightP : public token {
public:
    bool is_rightP() {
        return true;
    }
};

using toklist = list<unique_ptr<token>>;
toklist tokenize() {
    toklist t;
    while (cin.good() && !cin.eof()) {
        string temp;
        cin >> temp;

        if (temp == "+") {
            t.push_back(make_unique<t_plus>());
        }
        else if (temp == "*") {
            t.push_back(make_unique<t_star>());
        }
        else if (temp == "(") {
            t.push_back(make_unique<t_leftP>());
        }
        else if (temp == ")") {
            t.push_back(make_unique<t_rightP>());
        }
        else if (!temp.empty()) {
            int val;
            istringstream(temp) >> val;
            t.push_back(make_unique<t_int>(val));
        }

    }

    return t;
}

class Expr {
public:
    virtual int eval() = 0;
};

class Number : public Expr {
    int val;
public:
    Number(int v) : val(v) {}
    int eval() { return val; }
};

class Plus : public Expr {
    unique_ptr<Expr> l, r;
public:
    Plus(unique_ptr<Expr> &&l, unique_ptr<Expr> &&r) : l(move(l)), r(move(r)) {};
    int eval() {
        return l->eval() + r->eval();
    }
};

class Mult : public Expr {
    unique_ptr<Expr> l, r;
public:
    Mult(unique_ptr<Expr> &&l, unique_ptr<Expr> &&r) : l(move(l)), r(move(r)) {};
    int eval() {
        return l->eval() * r->eval();
    }
};

unique_ptr<Expr> parse_expr(toklist &t);

unique_ptr<Expr> parse_baseexpr(toklist& t) {

    if (!t.empty() && t.front()->is_int()) {
        int val = t.front()->get_int_val();
        t.pop_front();
        return make_unique<Number>(val);
    }
    if (!t.empty() && t.front()->is_leftP()) {
        t.pop_front();
        auto exp = parse_expr(t);
        if (!t.empty() && t.front()->is_rightP()) {
            t.pop_front();
            return exp;
        }
        else
            throw - 3;
    }
    throw - 2;

}
unique_ptr<Expr> parse_multexpr(toklist &t)
{
    unique_ptr<Expr> left = parse_baseexpr(t);
    if (!t.empty() && t.front()->is_star())
    {
        t.pop_front();
        return make_unique<Mult>(move(left), parse_multexpr(t));
    }
    else
    {
        return left;
    }
}


unique_ptr<Expr> parse_addexpr(toklist &t)
{
    unique_ptr<Expr> left = parse_multexpr(t);
    if (!t.empty() && t.front()->is_plus())
    {
        t.pop_front();
        return make_unique<Plus>(move(left), parse_addexpr(t));
    }
    else
    {
        return left;
    }
}

unique_ptr<Expr> parse_expr(toklist &t) {
    return parse_addexpr(t);
}

int main()
{
    auto t = tokenize();
    //for (auto&i : t) cout << typeid(*i).name() << endl;
    auto e = parse_expr(t);
    cout << e->eval() << endl;
    return 0;
}
