#C13048. Generate ISBN-10 with Correct Checksum
Generate ISBN-10 with Correct Checksum
Generate ISBN-10 with Correct Checksum
You are given a string that should represent a 9-digit number. Your task is to convert it into a valid 10-digit ISBN-10 number by appending the correct checksum digit at the end.
The checksum is calculated using the formula:
\( checksum = \left(\sum_{i=1}^{9} i \times d_i \right) \mod 11 \)
where \(d_i\) is the \(i\)th digit of the input string. If the checksum is 10, then it is represented by the character 'X'.
If the input string does not consist of exactly 9 digits, output "Invalid input".
inputFormat
The input consists of a single line containing a string. The string should represent exactly 9 digits.
outputFormat
If the input is valid, output the 10-digit ISBN-10 number (the original 9-digit string followed by the correct checksum digit). Otherwise, output "Invalid input".
## sample030640615
0306406152