An integer N (1 ≤ N ≤ 2000).
An integer M (1 ≤ M ≤ 2000).
An integer K (2 ≤ K ≤ 2000).

### Example Input:

```
12
2
2
```

### Function Signature:
Write a function f(N, M, K) that takes in the input.
def f(N: int, M: int, K: int):
    '''
    N: an integer
    M: an integer
    K: an integer
    '''