Numbers from digits#2323

Numbers from digits

1 secondo
128 megabyte
Molto facile

A non-negative integer is given. Using all its digits, form the largest possible number, and then the smallest one. Print the sum of these two numbers.

For example, for n = 56002, the largest number is , and the smallest one is (leading zeros in the number are not considered). The required sum is 65200 + 256 = 65456.

Input

One integer (0 \leq n \leq 10^8).

Output

Print the sum of the largest and the smallest numbers that can be obtained from by rearranging its digits.

Esempi

Esempio 1

Loading
Loading