#T515. 【NOIP2008-J1】ISBN号码
【NOIP2008-J1】ISBN号码
Description
Every officially published book has a corresponding ISBN (International Standard Book Number). An ISBN consists of 9 digits, 1 check digit, and 3 separators, formatted as "x-xxx-xxxxx-x", where the "-" symbol is a separator (keyboard hyphen), and the last digit is the check digit. For example, 0-670-82162-4 is a standard ISBN. The first digit of the ISBN represents the book's publishing language (e.g., 0 for English); the three digits after the first separator "-" represent the publisher (e.g., 670 for Viking Press); the five digits after the second separator represent the book's identifier within the publisher; and the last digit is the check digit.
The check digit is calculated as follows:
Multiply the first digit by 1, the second digit by 2, and so on, then sum all these products. Take the result modulo 11, and the remainder is the check digit. If the remainder is 10, the check digit is the uppercase letter 'X'. For example, the check digit 4 in the ISBN 0-670-82162-4 is calculated as follows: for the 9 digits 067082162, multiply each digit from left to right by 1, 2, ..., 9, respectively, and sum them: 0×1 + 6×2 + ... + 2×9 = 158. Then, take 158 mod 11, which yields 4, as the check digit.
Your task is to write a program to verify whether the check digit in the input ISBN is correct. If it is correct, output "Right"; otherwise, output the corrected ISBN (including the separators "-"). The input is a single line representing an ISBN (guaranteed to conform to the ISBN format).
Input Format
A single line containing a character sequence representing an ISBN (guaranteed to conform to the ISBN format).
Output Format
One line: if the input ISBN's check digit is correct, output "Right"; otherwise, output the corrected ISBN in the required format (including the separators "-").
```input1 0-670-82162-4 ``` ```output1 Right ``` ```input2 0-670-82162-0 ``` ```output2 0-670-82162-4 ``` ## SourceNOIP2008-J1