# Check Digits -- Problem G (15 points)

Identification numbers, like student ID or Inland Revenue numbers, usually have a relationship between the digits so that errors or bogus numbers can be picked up when they are entered. For example, one digit is equal to the weighted sum (with the weights alternatively +1 and -1) of the other digits, mod 11 (with numbers where this check digit would equal 10 omitted.) For some applications it is desirable to have a rule which is difficult to determine and which does not omit any numbers. For this problem, you will check ID numbers of up to 20 digits, with weights which are real numbers. You will form the weighted sum of the digits (except the check digit), reverse its sign if negative, round this number (.5 and greater rounds up; less than .5 rounds down) and find its value mod 10 (ie. the units digit, base 10). This digit must equal the check digit.

Input will be from a file PROBLEM2.DAT and will consist of a number of sets of checking scenarios. Each checking scenario will start with a line containing two integers. The first number, n, gives the number of digits in the ID numbers, and the second number, m, gives the position of the check digit (1=leftmost digit, n=rightmost digit, etcv). After this comes lines which contain the weights, which are real numbers given to 6 decimal places or fewer; each number is greater than -10 and less than 10. Note that the weight for the m'th digit is always zero. Then come a number of ID numbers which must be checked, one ID number per line. The list of ID numbers is terminated bya line consisting of a single 0. Then follows a line with two integers describing another scenario, and so on. The file will be terminated by a scenarios description line which contains two zeros.

Output, which must be written to standard output, will be one line for each ID number checked and will be the word "Yes" or "No" depending on whether the ID number passes the check or not.

```3 1
0
1.10
-0.999999
549
551
563
0
0 0
```

```Yes
Yes
No
```