An array of $N$ integers is given. Choosing two distinct positions $i \ne j$, the score is the digit sum of $a_i \times a_j$. Print the maximum achievable score.
Input
Line 1: $N$ ($2 \le N \le 100000$). Line 2: $a_1, \dots, a_N$ ($1 \le a_i \le 999$).
Output
Print the maximum digit-sum score over all pairs.
Example 1
Input
2 3 8
Output
6
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.