We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- All Contests
- ProjectEuler+
- Project Euler #240: Top Dice

# Project Euler #240: Top Dice

# Project Euler #240: Top Dice

Contest ends in

_{This problem is a programming version of Problem 240 from projecteuler.net}

There are ways in which five -sided dice (sides numbered to ) can be rolled so that the top three sum to . Some examples are:

In how many ways can -sided dice (sides numbered 1 to ) be rolled so that the top sum to ? Print your answer modulo

**Input Format**

The first and only line of each test file contains exactly integers separated by single spaces: , , and in this order.

**Constraints**

**Output Format**

Print exactly one number which is the answer to the problem.

**Sample Input 0**

```
5 6 3 15
```

**Sample Output 0**

```
1111
```