Multiple datasets, each dataset consists of the following:
An integer n (1 ≤ n ≤ 2000), an integer k (1 ≤ k ≤ n), and an integer s (3 ≤ s ≤ 100).
A list of n tuples, each containing three integers where each integer is between -4×10^7 and 4×10^7.

### Example Input:

```
1 1 100
100 100 100
4 4 10
100 100 100
108 94 100
116 100 100
108 106 100
```

### Function Signature:
Write a function f(datasets) that takes in the input.
```python
def f(datasets: List[Tuple[int, int, int, List[Tuple[int, int, int]]]]):
    ''' 
    datasets: a list of tuples, each containing:
              - an integer
              - an integer
              - an integer
              - a list of tuples, each containing three integers
    '''
```