eolymp
bolt
Try our new interface for solving problems
Problems

Numbers from digits

Numbers from digits

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 (0n108).

Output

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

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