#abc221c. [abc221_c]Select Mul
[abc221_c]Select Mul
Problem Statement
You are given an integer . Consider permuting the digits in and separate them into two positive integers.
For example, for the integer , there are six ways to separate it, as follows:
- and ,
- and ,
- and ,
- and ,
- and ,
- and .
Here, the two integers after separation must not contain leading zeros. For example, it is not allowed to separate the integer into and . Additionally, since the resulting integers must be positive, it is not allowed to separate into and , either.
What is the maximum possible product of the two resulting integers, obtained by the optimal separation?
Constraints
- is an integer between and (inclusive).
- contains two or more digits that are not .
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible product of the two integers after separation.
Sample Input 1
123
Sample Output 1
63
As described in Problem Statement, there are six ways to separate it:
- and ,
- and ,
- and ,
- and ,
- and ,
- and .
The products of these pairs, in this order, are , , , , , , with being the maximum.
Sample Input 2
1010
Sample Output 2
100
There are two ways to separate it:
- and ,
- and .
In either case, the product is .
Sample Input 3
998244353
Sample Output 3
939337176