Codeforces Round 195 (Div. 2)
D
Vasily the Bear and Beautiful Strings
Codeforces
2100
原题
← CE →
翻译中…

Vasily the Bear loves beautiful strings. String $*s*$ is beautiful if it meets the following criteria:

翻译中…
  1. String $*s*$ only consists of characters $0$ and $1$, at that character $0$ must occur in string $*s*$ exactly $*n*$ times, and character $1$ must occur exactly $*m*$ times.
  2. We can obtain character $*g*$ from string $*s*$ with some (possibly, zero) number of modifications. The character $*g*$ equals either zero or one.
翻译中…

A modification of string with length at least two is the following operation: we replace two last characters from the string by exactly one other character. This character equals one if it replaces two zeros, otherwise it equals zero. For example, one modification transforms string "01010" into string "0100", two modifications transform it to "011". It is forbidden to modify a string with length less than two.

翻译中…

Help the Bear, count the number of beautiful strings. As the number of beautiful strings can be rather large, print the remainder after dividing the number by $1000000007$ $(10^{9} + 7)$.

翻译中…

Input

翻译中…

The first line of the input contains three space-separated integers $*n*, *m*, *g*$ $(0 ≤ *n*, *m* ≤ 10^{5}, *n* + *m* ≥ 1, 0 ≤ *g* ≤ 1)$.

翻译中…

Output

翻译中…

Print a single integer — the answer to the problem modulo $1000000007$ $(10^{9} + 7)$.

翻译中…

Note

翻译中…

In the first sample the beautiful strings are: "01", "10".

翻译中…

In the second sample the beautiful strings are: "0011", "1001", "1010", "1100".

翻译中…

In the third sample there are no beautiful strings.

翻译中…

样例

Input #1
1 1 0
Output #1
2
InputCopy OutputCopy
Input #2
2 2 0
Output #2
4
InputCopy OutputCopy
Input #3
1 1 1
Output #3
0
InputCopy OutputCopy
题目信息
题号
336D
时间限制
2 s
内存限制
256 MB
标签
组合数学
数学
数论

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