DWITE Online Computer Programming Contest, February 2006, Problem 3
The final digit of a Universal Product Code is a check digit computed so that summing the even-numbered digits, plus times the odd-numbered digits, modulo , is .
For example, take the UPC 070617006092
. The sum of the even numbered
digits is , and the sum of the odd-numbered digits is
. The total sum is . So the
code is valid.
The input will contain five lines of data. Each line will contain a digit UPC that may have an invalid check digit.
The output will contain five lines of data. Each line will contain the UPC with the correct check digit.
Sample Input
070617006093
036000291455
123456789097
246809753116
543210987665
Sample Output
070617006092
036000291452
123456789098
246809753116
543210987667
Comments