题目描述
You have successfully completed your studies and are preparing to move from near Komaba to near Hongo. As I was organizing my house, I found a lot of lottery tickets I bought last year. After confirming the exchange deadline, I have to cash in by tomorrow, but it is troublesome to go to the lottery counter for a small amount of money because I am not ready to move at all. So you decide to find out how much you can win.
The lottery consists of eight digits. The winning number is also composed of 8 digits and a number and'*', and if the lottery you have and the number part match, the winning money will be paid according to the winning number.
For example, if the lottery number you have is "12345678", you will win if the winning number is "* 8" or "* 5678", but the winning number is "*". If it is ** 4678 ", you will not win. There can be multiple winning numbers, and the winnings will be paid independently for each. However, the winning numbers are chosen so that one lottery does not win more than one winning number. For example, if there are two winning numbers, "* 8" and "** 5678", "12345678" will win both, so such a winning number will be selected. There is no one to be done.
Your job is to write a program that outputs how much winning money you will get for the lottery number you have and the lottery winning number given as input.
Notes on Test Cases
Multiple datasets are given in the above input format. Create a program that outputs each data set in the above output format.
When n is 0, it indicates the end of input.
输入格式
见题面
输出格式
见题面