An integer N (1 ≤ N ≤ 2000), an integer D (1 ≤ D ≤ 10^12), and an integer X (1 ≤ X ≤ 2000). 
The input consists of multiple datasets. The number of datasets is no more than 100. 
The end of input is denoted by a line that contains three zeros.

### Example Input:

```
5 2 5
3 3 3
5 4 5
4 1 2
1 5 1
1250 50 50
0 0 0
```

### Function Signature:
Write a function f(inputs) that takes in the input. 
def f(inputs: List[Tuple[int, int, int]]): 
    ''' 
    inputs: a list of tuples, where each tuple contains three integers 
    '''