AtCoder Grand Contest 009
E
Eternal Average
AtCoder
⌀ 3428
原题
← D→
翻译中…

Problem Statement

翻译中…

There are $N$ zeros and $M$ ones written on a blackboard. Starting from this state, we will repeat the following operation: select $K$ of the rational numbers written on the blackboard and erase them, then write a new number on the blackboard that is equal to the arithmetic mean of those $K$ numbers. Here, assume that $N + M - 1$ is divisible by $K - 1$.

翻译中…

Then, if we repeat this operation until it is no longer applicable, there will be eventually one rational number left on the blackboard.

翻译中…

Find the number of the different possible values taken by this rational number, modulo $10^9 + 7$.

翻译中…

Constraints

翻译中…
  • $1 ≦ N, M ≦ 2000$
  • $2 ≦ K ≦ 2000$
  • $N + M - 1$ is divisible by $K - 1$.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N M K

翻译中…

Output

翻译中…

Print the number of the different possible values taken by the rational number that will be eventually left on the blackboard, modulo $10^9 + 7$.

翻译中…

样例

Input #1
2 2 2
Output #1
5
There are five possible values for the number that will be eventually left on the blackboard: $\frac{1}{4}$, $\frac{3}{8}$, $\frac{1}{2}$, $\frac{5}{8}$ and $\frac{3}{4}$. For example, $\frac{3}{8}$ can be eventually left if we: - Erase $0$ and $1$, then write $\frac{1}{2}$. - Erase $\frac{1}{2}$ and $1$, then write $\frac{3}{4}$. - Erase $0$ and $\frac{3}{4}$, then write $\frac{3}{8}$.
Input #2
3 4 3
Output #2
9
Input #3
150 150 14
Output #3
937426930
题目信息
题号
agc009_e
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。