eolymp
Competitions

Sort & Search

Numbers from digits

Given nonnegative integer n. Create from all its digits the biggest and then the smallest number. Print the sum of obtained numbers.

For example, for n = 56002 the biggest will be 65200 and the smallest will be 256 (the leading zeros in number 00256 do not count). The resulting sum is 65200 + 256 = 65456.

Input

One integers n (0n108).

Output

Print the sum of the biggest and the smallest numbers, that can be get from n by permutation of its digits.

Time limit 1 second
Memory limit 128 MiB
Input example #1
56002
Output example #1
65456