## 24 hour archive: Problem

###
** 3415
- IMEI’s Last Digit** ** 3415 - IMEI’s Last Digit** ** 3415 - IMEI’s Last Digit**

#### Description

Each IMEI has 15 digits distributed like this:

- the first 6 digits indicate the country where the phone was built

- the next 2 digits represent the factory where it was built

- the next 6 digits are the serial number of the cellphone

- and the last digit is used to verify if the IMEI is correct.

To find out the corresponding last digit one must follow a simple algorithm commonly known as Algorithm Modulo 10 or Luhn's Algorithm.

Given the first 14 digits of some IMEI enumerated from 0 to 13, the algorithm is as follows:

1 - take each digit in an odd position and replace it by its duplicated value.

2 - sum all the digits involved in the modified sequence

3 - find the remainder of dividing the sum by 10

4 - if the resulting number is greater then zero then IMEI's last digit is 10 less that number, otherwise is zero.

Now given the first fourteen digits of a single IMEI code. Can you help us find the last one ??

Each IMEI has 15 digits distributed like this:

- the first 6 digits indicate the country where the phone was built

- the next 2 digits represent the factory where it was built

- the next 6 digits are the serial number of the cellphone

- and the last digit is used to verify if the IMEI is correct.

To find out the corresponding last digit one must follow a simple algorithm commonly known as Algorithm Modulo 10 or Luhn's Algorithm.

Given the first 14 digits of some IMEI enumerated from 0 to 13, the algorithm is as follows:

1 - take each digit in an odd position and replace it by its duplicated value.

2 - sum all the digits involved in the modified sequence

3 - find the remainder of dividing the sum by 10

4 - if the resulting number is greater then zero then IMEI's last digit is 10 less that number, otherwise is zero.

Now given the first fourteen digits of a single IMEI code. Can you help us find the last one ??

Each IMEI has 15 digits distributed like this:

- the first 6 digits indicate the country where the phone was built

- the next 2 digits represent the factory where it was built

- the next 6 digits are the serial number of the cellphone

- and the last digit is used to verify if the IMEI is correct.

To find out the corresponding last digit one must follow a simple algorithm commonly known as Algorithm Modulo 10 or Luhn's Algorithm.

Given the first 14 digits of some IMEI enumerated from 0 to 13, the algorithm is as follows:

1 - take each digit in an odd position and replace it by its duplicated value.

2 - sum all the digits involved in the modified sequence

3 - find the remainder of dividing the sum by 10

4 - if the resulting number is greater then zero then IMEI's last digit is 10 less that number, otherwise is zero.

Now given the first fourteen digits of a single IMEI code. Can you help us find the last one ??

#### Input specification

A single
integer T (1 <= T <= 1000) the number of test cases

The next T
lines contain exactly fourteen consecutive integers representing a single IMEI
code

A single
integer T (1 <= T <= 1000) the number of test cases

The next T
lines contain exactly fourteen consecutive integers representing a single IMEI
code

A single
integer T (1 <= T <= 1000) the number of test cases

The next T
lines contain exactly fourteen consecutive integers representing a single IMEI
code

#### Output specification

For each
case print the last digit of the corresponding IMEI code

For each
case print the last digit of the corresponding IMEI code

A single
integer T (1 <= T <= 1000) the number of test cases

The next T
lines contain exactly fourteen consecutive integers representing a single IMEI
code

#### Sample input

`2`

35242103421555

35196605023935

#### Sample output

`0`

6