User's AC Ratio

96.0% (120/125)

Submission's AC Ratio

51.4% (190/370)

Tags

Description

European countries use a 12-digit code called European Article Number (EAN) for each product. Each EAN ends with a check digit, which is calculated by the following rules:

Add the second, fourth, sixth, eighth, tenth, and twelfth digits (as $a$).
Add the first, third, fifth, seventh, ninth, and eleventh digits (as $b$).
Multiply $a$ by $3$ and add it to $b$ (as $x$).
Subtract $1$ from $x$ ( as $y$).
Compute the remainder when $y$ is divided by $10$ (as $z$).
Substract $z$ from $9$.
Write a program that reads the first 12 digits of an EAN, and then displays the calculated check digit.

Input Format

12 digits

Output Format

1 digit

Sample Input 1

869148426000

Sample Output 1

8

Hints

Problem Source

Subtasks

No. Testdata Range Score
1 0~3 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1
1 1000 65536 65536 1
2 1000 65536 65536 1
3 1000 65536 65536 1