#include <bits/stdc++.h>
using namespace std;
int x, ans, n, t, mul = 1;
string s;
int main() {
  cin >> s;
  if (!(s[0] - 48 - 1)) {
    cout << long(pow(9, int(s.length() - 1)));
    exit(0);
  }
  for (int i = 0; i < s.length(); i++) {
    x = mul * (int(s[i]) - 49) * pow(9, int(s.length() - i - 1));
    ans = max(ans, x);
    mul = mul * (s[i] - 48);
  }
  cout << max(ans, mul);
}
