#include <bits/stdc++.h>
using namespace std;
long dp(vector<long>& table, const string& s, int i) {
  while (table[i] == -1) {
    if (i == s.size()) {
      table[i] = 1;
      break;
    }
    long A = (s[i] - '0') * dp(table, s, i + 1);
    int k = (s[i] - '1');
    if (!i) {
      k = max(k, 1);
    }
    long B = k * pow(9, s.size() - i - 1);
    table[i] = max(A, B);
  }
  return table[i];
}
int main() {
  string s;
  cin >> s;
  vector<long> table((s.size() + 1), -1);
  cout << dp(table, s, 0) << endl;
  return 0;
}
