An integer N (1 ≤ N ≤ 10^5), representing some quantity or size.
An integer pw (1 ≤ pw ≤ 100), representing some cost per unit.
N lines follow, each containing four integers:
- vw_i (-100 ≤ vw_i ≤ 100)
- pf_i (1 ≤ pf_i ≤ 100)
- vf_i (1 ≤ vf_i ≤ 100)
- th_i (-100 ≤ th_i ≤ 100)

The input consists of multiple datasets. The end of the input is indicated by a line containing a zero.

### Example Input:

```
3
10
4 3 4 10
5 4 5 20
6 5 6 30
3
7
-4 3 4 -10
5 4 5 20
6 5 6 30
0
```

### Function Signature:
Write a function f(inputs) that takes in the input. 
def f(inputs: List[Tuple[int, int, List[Tuple[int, int, int, int]]]]): 
    ''' 
    inputs: a list of tuples, where each tuple consists of:
        - an integer N
        - an integer pw
        - a list of N tuples, each containing four integers (vw_i, pf_i, vf_i, th_i)
    '''