#include using namespace std; template inline T toInteger(const string&); template<> inline int toInteger(const string& s) { return stoi(s); } template<> inline long toInteger(const string& s) { return stol(s); } template<> inline long long toInteger(const string& s) { return stoll(s); } template inline T toInteger(const string& s, int n) { T res = 0; for (char c : s) { if (isdigit(c)) res = res * n + c - '0'; else if (isalpha(c)) res = res * n + tolower(c) - 'a' + 10; } return s[0] == '-' ? -res : res; } template class Parser { private: string s; int p; vector>> ope; T term() { if (s[p] == '(') { ++p; T res = expr(0); ++p; return res; } string res = ""; for (; isdigit(s[p]); ++p) res += s[p]; return toInteger(res); } T expr(int level) { if (level == (int)ope.size()) return term(); T res = expr(level + 1); for (char c; c = s[p++], ope[level].count(c);) res = ope[level][c](res, expr(level + 1)); --p; return res; } public: void addOperator(function func, char c, int level) { if ((int)ope.size() <= level) ope.resize(level + 1); ope[level][c] = func; } long long parse(const string& s) { this->s = s + '@'; p = 0; return expr(0); } }; template inline T parse(const string& s) { Parser parser; parser.addOperator(plus(), '+', 0); parser.addOperator(minus(), '-', 0); parser.addOperator(multiplies(), '*', 1); parser.addOperator(divides(), '/', 1); return parser.parse(s); } int main() { string s; cin >> s; long long res = 0; for (size_t i = 0; i < s.size(); ++i) { if (isdigit(s[0]) && isdigit(s.back())) res = max(res, parse(s)); rotate(s.begin(), s.begin() + 1, s.end()); } cout << res << endl; }