### Input Description:

An integer N (3 ≤ N ≤ 500000), representing some quantity or size.
An integer A (0 ≤ A ≤ 10^9).
An integer B (0 ≤ B ≤ 10^9).
An integer C (0 ≤ C ≤ 10^9).
An integer D (C ≤ D ≤ 10^9) 

### Example Input:

```
15 1 5 2 4
```

### Function Signature:

Write a function f(N, A, B, C, D) that takes in the input. 

```python
def f(N: int, A: int, B: int, C: int, D: int):
    '''
    N: an integer
    A: an integer
    B: an integer
    C: an integer
    D: an integer
    '''
```