An integer H (1 ≤ H ≤ 500), representing some measurement.
An integer W (1 ≤ W ≤ 500), representing some measurement.
Three integers A, B, C (0 ≤ A, B, C ≤ 1,000,000,000), representing some quantities.
An integer N (2 ≤ N ≤ 100,000), representing a count.
N pairs of integers (S_i, T_i) where (0 ≤ S_i ≤ H) and (0 ≤ T_i ≤ W) for 1 ≤ i ≤ N.

### Example Input:
```
6 5
1 3 6
3
1 1
0 4
6 5
```

### Function Signature:
Write a function f(H, W, A, B, C, N, positions) that takes in the input.
```python
def f(H: int, W: int, A: int, B: int, C: int, N: int, positions: List[Tuple[int, int]]):
    '''
    H: an integer
    W: an integer
    A: an integer
    B: an integer
    C: an integer
    N: an integer
    positions: a list of tuples
    '''
```