Lookcook the geniosity easily finished the Canadian Computing Competition this year and got a score of
Input Specification
The first line contains
Then
The first line of each case contains
The second line contains
Output Specification
The smallest number that can be obtained by moving at most
Constraints
The product of
Sample Input
8
891
0
891
1
891
2
51111
100
98614
3
9921991111
5
1324331974
8
2364851699
5
Sample Output
891
819
189
11115
14689
1111129999
1123334479
2169934568
Comments