#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3];
  int b = 0;
  int c = 0;
  int d = 30;
  int l;
  for (int i = 0; i < 3; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      b++;
      l = i;
    }
    if (a[i] > c) c = a[i];
    if (a[i] < d) d = a[i];
  }
  if (b == 0)
    cout << a[0] * a[1] * a[2];
  else if (b == 3)
    cout << (b);
  else if (b == 2 && c == a[1])
    cout << c + 2;
  else if (b == 2 && c != a[1])
    cout << 2 * c;
  else if (b == 1) {
    if (l == 0)
      cout << (1 + a[1]) * a[2];
    else if (l == 1)
      cout << (a[0] + a[1] + a[2] - c) * c;
    else
      cout << a[0] * (a[1] + 1);
  }
  return 0;
}
