#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int a, b, c;
  cin >> a >> b >> c;
  if (a == 1 && b == 1 && c == 1)
    cout << "3";
  else if (a == 1 && b == 1 && c != 1)
    cout << 2 * c;
  else if (a != 1 && b == 1 && c == 1)
    cout << 2 * a;
  else if (a == 1 && b != 1 && c == 1)
    cout << b + 2;
  else if (a != 1 && b == 1 && c != 1) {
    if (a >= c)
      cout << (c + 1) * a;
    else
      cout << (a + 1) * c;
  } else if (a == 1 && b != 1 && c != 1)
    cout << (b + 1) * c;
  else if (a != 1 && b != 1 && c == 1)
    cout << (b + 1) * a;
  else
    cout << a * b * c;
}
