# Dice with k-sides

**Computer Science**Level 4

A standard 6 sided die rolls the numbers 1 through 6 with equal probability. Likewise, a *k*-sided die rolls the numbers from 1 through k with equal probability.

Let **D(S, N, k)** equal the number of ways to roll a total of **S** with **N** **k**-sided dice. D(3, 2, 6) = 2 because you can roll a 3 with a (1, 2) or a (2, 1).

Let **T** = D(20, 7, 12) + D(31, 6, 4) + D(15, 3, 7) + D(111, 17, 7) + D (17, 3, 57) + D(1, 2, 2) + D(10, 17, 12) + D(9, 3, 0).

What are the last three digits of T?