Unknown digit
Not long ago, the well-known slacker from previous Olympiads, student Khvostenko, graduated from university. Now, he is a respectable figure—Stepan Andriyovych Khvostenko, a postgraduate student under Professor Integralov. He is involved in mathematics, computer science, and robotics, conducting scientific research, and in his spare time, he prepares the university team for programming competitions. Naturally, he needs to select students who are talented and think unconventionally for the team. To do this, he presents them with various puzzles and problems to solve. For instance, in the latest selection process, he proposed the following challenge.
There are nine digits: 1, 2, 3, 4, 5, 6, 7, 8, and 9. One digit is removed, and the remaining digits are arranged into several columns (ranging from 1 to 8). Then, all the digits in each column are summed, and the results are combined to form a single number K, which is created by concatenating the summation results of all columns.
Your task is to determine the digit that was removed, given the number K. Try to solve this problem on your own.
For example, if the digit 4 was removed and the remaining digits were randomly arranged into three columns:
The number K would be: 71816
Input
A single number K.
Output
The digit that was removed.