Numbers from digits
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given a nonnegative integer n. From all its digits create the biggest and then the smallest number. Print the sum of the obtained numbers.
For example, for n = 56002 the biggest will be 65200 and the smallest will be 256 (the leading zeros in the number 00256 do not count). The resulting sum is 65200 + 256 = 65456.
Input
One integers n (0 ≤ n ≤ 10^8
).
Output
Print the sum of the biggest and the smallest numbers, that can be gotten from n by permutation of its digits.
Examples
Input #1
Answer #1
Submissions 4K
Acceptance rate 61%