An integer N (2 ≤ N ≤ 10^5), representing some quantity or size.
A list of integers A of size N, where each integer is between 0 and 10^9.
A list of N-1 pairs of integers (a_i, b_i), where 1 ≤ a_i, b_i ≤ N.

### Example Input:

```
5
1 2 1 1 2
2 4
5 2
3 2
1 3
```

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