UVa 10943 - How do you add?

10943 - How do you add?
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1884

Summary
Find the number of ways to form Number N from the addition of K numbers less than N.

Explanation
Observing that the number of ways are N+K-1 C K-1, we precompute the values and answer query in O(1).

Gotchas
Output is mod 1e6.

Input
63 59 100 100 0 0

Output
649440 420660