#include <iostream>
#include <string>
using namespace std;
int main()
{
string str, tmp;
while ( cin >> tmp )
{
str.append( tmp );
}
int greatest(0);
for ( string::size_type i = 4; i < str.length(); ++i )
{
int product = (str[i]-'0') * (str[i-1]-'0') * (str[i-2]-'0') * (str[i-3]-'0') * (str[i-4]-'0');
if ( product > greatest )
{
greatest = product;
}
}
cout << greatest << endl;
return 0;
}