#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

typedef string::const_iterator State;
class ParseError {};

struct Parser {
    // エラー検出
    void consume(State &begin, char expected) {
        if(*begin == expected) begin++;
        else {
            cerr << "Expected '" << expected << "' but got '" << *begin << "'" << endl;
            cerr << "Rest string is '";
            while(*begin) {
                cerr << *begin++;
            }
            cerr << "'" << endl;
            throw ParseError();
        }
    }

    // 数字の列をパースして、その数を返す
    ll number(State &begin) {
        ll ret = 0;
        while(isdigit(*begin)) {
            ret *= 10;
            ret += (*begin - '0');
            begin++;
        }
        return ret;
    }

    // 括弧か数をパースして、その評価結果を返す
    ll factor(State &begin, string x) {
        if(*begin == '(') {
            consume(begin, '(');    // '('を飛ばす
            ll ret = expression(begin, x);
            consume(begin, ')');    // ')'を飛ばす
            return ret;
        }else return number(begin);
    }

    // 最優先演算
    ll termtop(State &begin, string x) {
        ll ret = factor(begin, x);
        // xの先頭のみ
        while(1) {
            if(*begin == x.at(0)) {
                if(x.at(0) == '+') {
                    consume(begin, '+');
                    ret += factor(begin, x);
                }else if(x.at(0) == '-') {
                    consume(begin, '-');
                    ret -= factor(begin, x);
                }else if(x.at(0) == '*') {
                    consume(begin, '*');
                    ret *= factor(begin, x);
                }else break;
            }else break;
        }
        return ret;
    }

    // 乗算除算の式をパースして、その評価結果を返す
    // 優先度の高いものはここで処理
    ll term(State &begin, string x) {
        ll ret = termtop(begin, x);
        // xの真ん中2つを採用
        while(1) {
            if(*begin == x.at(1)) {
                if(x.at(1) == '+') {
                    consume(begin, '+');
                    ret += termtop(begin, x);
                }else if(x.at(1) == '-') {
                    consume(begin, '-');
                    ret -= termtop(begin, x);
                }else if(x.at(1) == '*') {
                    consume(begin, '*');
                    ret *= termtop(begin, x);
                }else break;
            }else if(*begin == x.at(2)) {
                if(x.at(2) == '+') {
                    consume(begin, '+');
                    ret += termtop(begin, x);
                }else if(x.at(2) == '-') {
                    consume(begin, '-');
                    ret -= termtop(begin, x);
                }else if(x.at(2) == '*') {
                    consume(begin, '*');
                    ret *= termtop(begin, x);
                }else break;
            }else break;
        }
        return ret;
    }

    // 四則演算の式をパースして、その評価結果を返す
    ll expression(State &begin, string x) {
        ll ret = term(begin, x);
        // xの後ろ3つを採用
        while(1) {
            if(*begin == x.at(3)) {
                if(x.at(3) == '+') {
                    consume(begin, '+');
                    ret += term(begin, x);
                }else if(x.at(3) == '-') {
                    consume(begin, '-');
                    ret -= term(begin, x);
                }else if(x.at(3) == '*') {
                    consume(begin, '*');
                    ret *= term(begin, x);
                }else break;
            }else if(*begin == x.at(4)) {
                if(x.at(4) == '+') {
                    consume(begin, '+');
                    ret += term(begin, x);
                }else if(x.at(4) == '-') {
                    consume(begin, '-');
                    ret -= term(begin, x);
                }else if(x.at(4) == '*') {
                    consume(begin, '*');
                    ret *= term(begin, x);
                }else break;
            }else if(*begin == x.at(5)) {
                if(x.at(5) == '+') {
                    consume(begin, '+');
                    ret += term(begin, x);
                }else if(x.at(5) == '-') {
                    consume(begin, '-');
                    ret -= term(begin, x);
                }else if(x.at(5) == '*') {
                    consume(begin, '*');
                    ret *= term(begin, x);
                }else break;
            }else break;
        }
        return ret;
    }
};

int main() {
    string s; getline(cin, s);
    string op = "ABC+-*";
    vector<int> opvec = {0, 1, 2, 3, 4, 5};
    ll ans = LONG_MIN;
    do {
        Parser ps;
        State begin = s.begin();
        string opnow;
        for(int i = 0; i < 6; ++i) opnow.push_back(op.at(opvec.at(i)));
        // cout << opnow << endl;
        ll now = ps.expression(begin, opnow);
        // cout << now << endl;
        chmax(ans, now);
    }while(next_permutation(opvec.begin(), opvec.end()));
    cout << ans << endl;
}


Measured memory_bytes: 3236