Background
At DUT, the Dreamland University of Technology, all students have personal id, numbers with six or seven digits. But they're not just any numbers. Only those that have a checksum with a zero as last digit can be valid ids.
Problem
Here's how to compute the checksum of an id number. Multiply the digits from back to front (!) with repeating factors 9, 3, 7. Then simply add the products. Example:
id number : 1 3 9 0 2 7 2
factors : 9 7 3 9 7 3 9
products : 9 21 27 0 14 21 18
The first line contains the number of scenarios. Each scenario is a single line that contains an id number with one digit replaced by a question mark and with six or seven digits length.
The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then print a single line containing the correct id number. Terminate the output for the scenario with a blank line.
4 13?0272 3?5678 345?78 314?592
Scenario #1: 1390272 Scenario #2: 335678 Scenario #3: 345778 Scenario #4: 3146592
Huge input and output,scanf and printf are recommended.