UVa 10943 - How do you add?

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
64 59 100 100 0 0

Output
649440 420660