An integer D (1 ≤ D ≤ 100,000), representing some quantity or size.
A list of integers X of size D, where each integer is between -10^8 and 10^8.
An integer Q (1 ≤ Q ≤ 100,000), representing some quantity or size.
A list of Q tuples, each containing three integers (l, r, e) where 1 ≤ l ≤ r ≤ D and 0 ≤ e ≤ 10^8.

### Example Input:

```
7
4 1 10 5 7 7 3
5
2 5 0
3 6 1
3 6 2
1 7 2
1 7 5
```

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