You have to compute the value of “folding” a number. “Folding” a number \(n\) is an operation shown in the following figure (open the PDF if you can’t see the figure correctly on the Jutge web page).
In particular, any number \(n\) can be considered a sequence of digits and be divided into two subsequences of consecutive digits \(a\) and \(b\), be they of the same length, or alternatively of lengths differing only in one unit (including the case where \(a\) or \(b\) are empty). Concatenating these two halves \(a\) and \(b\) we would recover the original number \(n\).
Then, to compute the ”folding” operation, we invert the order of the \(a\) subsequence, which we will call \(a_{inv}\), and, interpreting \(a_{inv}\) and \(b\) as numbers once again, add them together to obtain the result of ”folding”.
As an example, if \(n\) is 1234, the subsequence \(a\) is 12 and \(b\) is 34. Inverting the order of \(a\) gives 21, and the result will be, then, \(21 + 34 = 55\).
In the case where \(n\) has an odd length, the partition can be made in two different ways. For instance, if \(n\) is 12345, we can compute the ”folding” in these two ways:
The middle digit, then, ends up contributing in the same way to the final sum in both cases.
Input
The input consists of a sequence of strictly positive integers.
Output
The output consists of each number in the input “folded” as explained, each one in a separate line.
PRO1
© Jutge.org, 2006–2024
Input
1 55 444 555 9901 12345 123456 9991001
Output
1 -> 1 55 -> 10 444 -> 48 555 -> 60 9901 -> 100 12345 -> 366 123456 -> 777 9991001 -> 2000