#include <bits/stdc++.h>
int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  if (a > b && a > c) {
    if ((b == 1 && c == 1) || (b == 1 && c > b) || (c == 1 && b > c)) {
      printf("%d\n", a * (b + c));
    } else if (b == c || b > c || c > b) {
      printf("%d\n", a * (b * c));
    }
  } else if (b > a && b > c) {
    if (a == 1 && c == 1) {
      printf("%d\n", a + b + c);
    } else if (a == 1) {
      printf("%d\n", (a + b) * c);
    } else if (c == 1) {
      printf("%d\n", a * (b + c));
    } else if (a == c || a > c || c > a) {
      printf("%d\n", a * b * c);
    }
  } else if (c > a && c > b) {
    if ((b == 1 && a == 1) || (b == 1 && a > b) || (a == 1 && b > a)) {
      printf("%d\n", c * (a + b));
    } else if (b == a || b > a || a > b) {
      printf("%d\n", a * (b * c));
    }
  } else if (a == 1 && b == 1 && c == 1) {
    printf("%d\n", a + b + c);
  } else if (a == b || b == c || c == a) {
    if (a * b * c >= (a + b) * c && a * b * c >= (c + b) * a &&
        a * b * c >= (a + c) * b)
      printf("%d\n", a * b * c);
    else if ((a + b) * c >= a * b * c && (a + b) * c >= a * (b + c) &&
             (a + b) * c >= (a + c) * b)
      printf("%d\n", (a + b) * c);
    else if ((c + b) * a >= a * b * c && (c + b) * a >= (a + b) * c &&
             (c + b) * a >= (a + c) * b)
      printf("%d\n", (c + b) * a);
    else if ((a + c) * b >= a * b * c && (a + c) * b >= (a + b) * c &&
             (a + c) * b >= (b + c) * a)
      printf("%d\n", (a + c) * b);
  }
}
