P27362 [AtCoder] Check Digit
普及
题目描述

Problem Description

Takahashi issued a code \( S \) made up of 15 digits. \( S \) is a string of length 15 consisting only of characters 0, ..., 9.

The rightmost digit of this 15-digit code is a check digit, which can be calculated from the remaining 14 digits.

First, sum all the digits in the left 14 digits that are in odd positions (counting the leftmost digit as position 1), and multiply this sum by 3. Then, add to this value all the digits in even positions. The remainder of this value when divided by 10 should match the 15th digit for the code to be correct; otherwise, the code is incorrect.

Create a program to determine if the code \( S \) is correct on behalf of Takahashi.

Input Format

The input is given from the standard input in the following format:

\( S \)

Output Format

Output Yes if the code \( S \) is correct, otherwise output No.

Sample Input and Output

Sample Input #1

123451234512345

Sample Output #1

No

Sample Input #2

123451234512348

Sample Output #2

Yes

Notes/Hints

Constraints

  • The length of \( S \) is 15.
  • \( S \) consists only of characters 0, ..., 9.

Sample Explanation 1

Summing the digits in odd positions of the left 14 digits gives \( 1+3+5+2+4+1+3=19 \). Multiplying this by 3 gives \( 57 \). Adding the digits in even positions to \( 57 \) results in \( 57+2+4+1+3+5+2+4=78 \). The remainder of \( 78 \) when divided by 10 is \( 8 \), which does not match the 15th digit \( 5 \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
123451234512345
样例输出
No