    
An integer N (1 ≤ N ≤ 150).
An integer K (1 ≤ K ≤ N).
An integer M (10^8 ≤ M ≤ 10^9).

### Example Input:

```
13 1 998244353
```

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