#include <bits/stdc++.h>   using namespace std;   long long p[11];   int main() {     string s;     cin >> s;     int n = s.size();     p[0] = 1;     for (int i = 1; i < n; i++) p[i] = p[i - 1] * 9ll;     long long ans = 1ll;     for (char c : s) ans *= (long long)(c -  0 );     ans = max(ans, p[n - 1]);     long long pre = 1;     for (int i = 1; i <= n; i++) {       for (long long j = 1; j < s[i - 1] -  0 ; j++) {         ans = max(ans, pre * j * p[n - i]);       }       pre *= (long long)(s[i - 1] -  0 );     }     cout << ans <<   n ;     return 0;   }   