LogiQuest

250. Dice Sum Ways

MediumDynamic ProgrammingCounting

Count the ways to get the sum s by rolling d dice with f faces each (faces 1..f; order matters). Print modulo 10⁹ + 7.

Input format

A single line: d f s

Output format

The number of ways mod 10⁹ + 7.

Example 1

Input

1 6 3

Output

1

Example 2

Input

2 6 7

Output

6

Constraints

1 ≤ d, f ≤ 30 1 ≤ s ≤ 1000

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…