An integer Q (1 ≤ Q ≤ 100000), and an integer L (1 ≤ L ≤ 10^9).
A list of Q queries, where each query is either:
- A single integer 0.
- Two integers 1 and d (1 ≤ d ≤ 10^9).
- Two integers 2 and k (1 ≤ k ≤ 10^9).
- Three integers 3, x, and r (0 ≤ x ≤ L, 0 ≤ r ≤ 10^9).
- Two integers 4 and k (1 ≤ k ≤ 10^9).

Input ends with two zeros (0 0).

### Example Input:

```
18 10
0
4 1
1 1
4 1
0
1 1
0
2 2
1 10
0
1 1
0
1 5
3 4 0
3 4 1
0
9 10
4 1
2 2
3 5 5
0
4 1
2 2
3 5 5
0
2 1
0 0
```

### Function Signature:
Write a function `process_inputs(inputs)` that takes in the input.
```python
def process_inputs(inputs: List[Tuple[int, int, Optional[int], Optional[int]]]):
    '''
    inputs: a list of tuples representing the queries
    '''
```