Hide

Problem B
CPR Number

Languages da en

Danish citizens have a unique personal identification number in the Danish Central Person Register, called the CPR number.

Each CPR number consists of ten digits. The first six digits represent the person’s day of birth. The following four digits are a sequence number.

Until 2007, all Danish CPR numbers had to follow the modulo 11 rule: The CPR number c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 must satisfy that

4c1+3c2+2c3+7c4+6c5+5c6+4c7+3c8+2c9+1c10

is divisible by 11 without remainder.

A publication from the government agency CPR-Kontoret from 1 July 2008 explains the method using the CPR number 070761-4285 as an example.

Validating a number with check digit

The 10 integers

0

7

0

7

6

1

4

2

8

5

multiplied by

×

×

×

×

×

×

×

×

×

×

their corresponding values

4

3

2

7

6

5

4

3

2

1

yield

0

+21

+0

+49

+36

+5

+16

+6

+16

+5

which sums to 154. Dividing 154 by 11 yields 14 with no remainder.

Since 11 divides 154 without remainder, the test is passed. Otherwise the combination of 10 digits is wrong, or the CPR number does not have a check digit.

Input

A CPR number in the format ddmmyy-kkkk, i.e, 10 digits separated by a single hyphen. It is guaranteed that ddmmyy is a valid date.

Output

“1” if the CPR Number is valid accoring to the modulo 11 test, else “0”.

Sample Input 1 Sample Output 1
070761-4285
1
Sample Input 2 Sample Output 2
051002-4321
0
Sample Input 3 Sample Output 3
310111-0469
1
Hide

Please log in to submit a solution to this problem

Log in