B. Recurring Decimal to Fractions
time limit per test
4.5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
2
1 3
0
012
3 1
085
3
Output
2 1665
32 375