import java.io.*;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class TaskC {
private final InputReader reader;
private final OutputWriter writer;
public TaskC(InputReader reader, OutputWriter writer) {
this.reader = reader;
this.writer = writer;
}
public static void main
(String[] args
) { InputReader reader
= new InputReader
(System.
in); OutputWriter writer
= new OutputWriter
(System.
out); new TaskC(reader, writer).run();
writer.writer.flush();
}
int[] A;
int[] tp;
class Pair {
long x, y;
Pair(long x, long y) {
this.x = x;
this.y = y;
}
}
long get(int l, int r) {
if (l > r)
return 1;
long cur = A[l];
long sum = 0;
for (int i = l + 1; i <= r; i++) {
if (tp[i] == 1) {
sum += cur;
cur = A[i];
} else {
cur *= A[i];
}
}
return sum + cur;
}
public void run() {
char[] buf = reader.next().toCharArray();
A = new int[buf.length / 2 + 1];
int n = A.length;
for (int i = 0; i < n; i++)
A[i] = buf[2 * i] - '0';
tp = new int[n];
tp[0] = 0;
int stars = 0;
for (int i = 1; i < n; i++) {
tp[i] = buf[2 * i - 1] == '+' ? 1 : 0;
stars += 1 - tp[i];
}
stars++;
int[] pos = new int[stars * 2 + 2];
int pt = 0;
for (int i = 0; i < n; i++) {
if (tp[i] == 0) {
pos[pt++] = i;
pos[pt++] = i - 1;
if (pos[pt - 1] < 0)
pos[pt - 1] = 0;
}
}
pos[pt++] = 0;
pos[pt++] = n - 1;
pt = 1;
for (int i = 1; i < pos.length; i++)
if (pos[i] != pos[pt - 1])
pos[pt++] = pos[i];
pos
= Arrays.
copyOfRange(pos,
0, pt
); long best = 0;
for (int l : pos) {
for (int r : pos) {
if (l > r)
continue;
long val = get(l, r);
long sum = 0, cur = (l == 0) ? val : A[0];
for (int i = (l == 0) ? r + 1 : 1; i < n; i++) {
long w = (i == l) ? val : A[i];
if (tp[i] == 1) {
sum += cur;
cur = w ;
} else {
cur *= w;
}
if (i == l)
i = r;
}
sum += cur;
best
= Math.
max(best, sum
); }
}
writer.printf("%d\n", best);
}
static class InputReader {
tokenizer = null;
}
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
}
}
return tokenizer.nextToken();
}
public int nextInt() {
}
public double nextDouble() {
return Double.
parseDouble(next
()); }
public long nextLong() {
return Long.
parseLong(next
()); }
}
static class OutputWriter {
}
}
}
}
aW1wb3J0IGphdmEuaW8uKjsKaW1wb3J0IGphdmEudXRpbC5BcnJheXM7CmltcG9ydCBqYXZhLnV0aWwuTG9jYWxlOwppbXBvcnQgamF2YS51dGlsLlN0cmluZ1Rva2VuaXplcjsKCnB1YmxpYyBjbGFzcyBUYXNrQyB7CiAgICBwcml2YXRlIGZpbmFsIElucHV0UmVhZGVyIHJlYWRlcjsKICAgIHByaXZhdGUgZmluYWwgT3V0cHV0V3JpdGVyIHdyaXRlcjsKCiAgICBwdWJsaWMgVGFza0MoSW5wdXRSZWFkZXIgcmVhZGVyLCBPdXRwdXRXcml0ZXIgd3JpdGVyKSB7CiAgICAgICAgdGhpcy5yZWFkZXIgPSByZWFkZXI7CiAgICAgICAgdGhpcy53cml0ZXIgPSB3cml0ZXI7CiAgICB9CgogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIElucHV0UmVhZGVyIHJlYWRlciA9IG5ldyBJbnB1dFJlYWRlcihTeXN0ZW0uaW4pOwogICAgICAgIE91dHB1dFdyaXRlciB3cml0ZXIgPSBuZXcgT3V0cHV0V3JpdGVyKFN5c3RlbS5vdXQpOwogICAgICAgIG5ldyBUYXNrQyhyZWFkZXIsIHdyaXRlcikucnVuKCk7CiAgICAgICAgd3JpdGVyLndyaXRlci5mbHVzaCgpOwogICAgfQoKICAgIGludFtdIEE7CiAgICBpbnRbXSB0cDsKCiAgICBjbGFzcyBQYWlyIHsKICAgICAgICBsb25nIHgsIHk7CiAgICAgICAgUGFpcihsb25nIHgsIGxvbmcgeSkgewogICAgICAgICAgICB0aGlzLnggPSB4OwogICAgICAgICAgICB0aGlzLnkgPSB5OwogICAgICAgIH0KICAgIH0KCiAgICBsb25nIGdldChpbnQgbCwgaW50IHIpIHsKICAgICAgICBpZiAobCA+IHIpCiAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgIGxvbmcgY3VyID0gQVtsXTsKICAgICAgICBsb25nIHN1bSA9IDA7CiAgICAgICAgZm9yIChpbnQgaSA9IGwgKyAxOyBpIDw9IHI7IGkrKykgewogICAgICAgICAgICBpZiAodHBbaV0gPT0gMSkgewogICAgICAgICAgICAgICAgc3VtICs9IGN1cjsKICAgICAgICAgICAgICAgIGN1ciA9IEFbaV07CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBjdXIgKj0gQVtpXTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gc3VtICsgY3VyOwogICAgfQoKICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKICAgICAgICBjaGFyW10gYnVmID0gcmVhZGVyLm5leHQoKS50b0NoYXJBcnJheSgpOwogICAgICAgIEEgPSBuZXcgaW50W2J1Zi5sZW5ndGggLyAyICsgMV07CiAgICAgICAgaW50IG4gPSBBLmxlbmd0aDsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykKICAgICAgICAgICAgQVtpXSA9IGJ1ZlsyICogaV0gLSAnMCc7CiAgICAgICAgdHAgPSBuZXcgaW50W25dOwogICAgICAgIHRwWzBdID0gMDsKICAgICAgICBpbnQgc3RhcnMgPSAwOwogICAgICAgIGZvciAoaW50IGkgPSAxOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgICAgIHRwW2ldID0gYnVmWzIgKiBpIC0gMV0gPT0gJysnID8gMSA6IDA7CiAgICAgICAgICAgIHN0YXJzICs9IDEgLSB0cFtpXTsKICAgICAgICB9CiAgICAgICAgc3RhcnMrKzsKICAgICAgICBpbnRbXSBwb3MgPSBuZXcgaW50W3N0YXJzICogMiArIDJdOwogICAgICAgIGludCBwdCA9IDA7CiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICAgICAgaWYgKHRwW2ldID09IDApIHsKICAgICAgICAgICAgICAgIHBvc1twdCsrXSA9IGk7CiAgICAgICAgICAgICAgICBwb3NbcHQrK10gPSBpIC0gMTsKICAgICAgICAgICAgICAgIGlmIChwb3NbcHQgLSAxXSA8IDApCiAgICAgICAgICAgICAgICAgICAgcG9zW3B0IC0gMV0gPSAwOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHBvc1twdCsrXSA9IDA7CiAgICAgICAgcG9zW3B0KytdID0gbiAtIDE7CgogICAgICAgIEFycmF5cy5zb3J0KHBvcyk7CiAgICAgICAgcHQgPSAxOwogICAgICAgIGZvciAoaW50IGkgPSAxOyBpIDwgcG9zLmxlbmd0aDsgaSsrKQogICAgICAgICAgICBpZiAocG9zW2ldICE9IHBvc1twdCAtIDFdKQogICAgICAgICAgICAgICAgcG9zW3B0KytdID0gcG9zW2ldOwogICAgICAgIHBvcyA9IEFycmF5cy5jb3B5T2ZSYW5nZShwb3MsIDAsIHB0KTsKICAgICAgICBsb25nIGJlc3QgPSAwOwogICAgICAgIGZvciAoaW50IGwgOiBwb3MpIHsKICAgICAgICAgICAgZm9yIChpbnQgciA6IHBvcykgewogICAgICAgICAgICAgICAgaWYgKGwgPiByKQogICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgbG9uZyB2YWwgPSBnZXQobCwgcik7CiAgICAgICAgICAgICAgICBsb25nIHN1bSA9IDAsIGN1ciA9IChsID09IDApID8gdmFsIDogQVswXTsKICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAobCA9PSAwKSA/IHIgKyAxIDogMTsgaSA8IG47IGkrKykgewogICAgICAgICAgICAgICAgICAgIGxvbmcgdyA9IChpID09IGwpID8gdmFsIDogQVtpXTsKICAgICAgICAgICAgICAgICAgICBpZiAodHBbaV0gPT0gMSkgewogICAgICAgICAgICAgICAgICAgICAgICBzdW0gKz0gY3VyOwogICAgICAgICAgICAgICAgICAgICAgICBjdXIgPSB3IDsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBjdXIgKj0gdzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT0gbCkKICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdW0gKz0gY3VyOwogICAgICAgICAgICAgICAgYmVzdCA9IE1hdGgubWF4KGJlc3QsIHN1bSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgd3JpdGVyLnByaW50ZigiJWRcbiIsIGJlc3QpOwogICAgfQoKCiAgICBzdGF0aWMgY2xhc3MgSW5wdXRSZWFkZXIgewogICAgICAgIHB1YmxpYyBCdWZmZXJlZFJlYWRlciByZWFkZXI7CiAgICAgICAgcHVibGljIFN0cmluZ1Rva2VuaXplciB0b2tlbml6ZXI7CgogICAgICAgIHB1YmxpYyBJbnB1dFJlYWRlcihJbnB1dFN0cmVhbSBzdHJlYW0pIHsKICAgICAgICAgICAgcmVhZGVyID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBJbnB1dFN0cmVhbVJlYWRlcihzdHJlYW0pLCAzMjc2OCk7CiAgICAgICAgICAgIHRva2VuaXplciA9IG51bGw7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgU3RyaW5nIG5leHQoKSB7CiAgICAgICAgICAgIHdoaWxlICh0b2tlbml6ZXIgPT0gbnVsbCB8fCAhdG9rZW5pemVyLmhhc01vcmVUb2tlbnMoKSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB0b2tlbml6ZXIgPSBuZXcgU3RyaW5nVG9rZW5pemVyKHJlYWRlci5yZWFkTGluZSgpKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbihlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gdG9rZW5pemVyLm5leHRUb2tlbigpOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIGludCBuZXh0SW50KCkgewogICAgICAgICAgICByZXR1cm4gSW50ZWdlci5wYXJzZUludChuZXh0KCkpOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIGRvdWJsZSBuZXh0RG91YmxlKCkgewogICAgICAgICAgICByZXR1cm4gRG91YmxlLnBhcnNlRG91YmxlKG5leHQoKSk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgbG9uZyBuZXh0TG9uZygpIHsKICAgICAgICAgICAgcmV0dXJuIExvbmcucGFyc2VMb25nKG5leHQoKSk7CiAgICAgICAgfQogICAgfQoKICAgIHN0YXRpYyBjbGFzcyBPdXRwdXRXcml0ZXIgewogICAgICAgIHB1YmxpYyBQcmludFdyaXRlciB3cml0ZXI7CgogICAgICAgIE91dHB1dFdyaXRlcihPdXRwdXRTdHJlYW0gc3RyZWFtKSB7CiAgICAgICAgICAgIHdyaXRlciA9IG5ldyBQcmludFdyaXRlcihzdHJlYW0pOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIHZvaWQgcHJpbnRmKFN0cmluZyBmb3JtYXQsIE9iamVjdC4uLiBhcmdzKSB7CiAgICAgICAgICAgIHdyaXRlci5wcmludChTdHJpbmcuZm9ybWF0KExvY2FsZS5FTkdMSVNILCBmb3JtYXQsIGFyZ3MpKTsKICAgICAgICB9CiAgICB9Cn0KCg==