When Grace was in third grade, her elementary school teacher assigned her the following problem:
What is the smallest possible sum of two numbers that together use the numerals 1, 2, 7, 8, and 9?
Grace figured out that the answer to this problem is 207 (for example, as 78 + 129), but when the teacher assigned four pages of similar problems as homework, Grace got bored. It turns out that Grace was a rather advanced third grader, so she decided that it would be more fun to write a computer program to solve such problems. Surely you can do the same!
Input: Each problem is described on a single line.
The line begins with an integer N, such that
Output: For each case, output a line with the minimum sum S that can be achieved. Please keep in mind that by standard convention, the numeral 0 cannot appear as the first digit of either summand.
|Example input:||Example output:|
5 1 2 7 8 9