跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F2348. Vasily the Bear and Beautiful Strings

    ID: 2354 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>组合数学数学数论提高难度共享题库Codeforces英文题面题目来源题面语言

Vasily the Bear and Beautiful Strings

题目描述

D. Vasily the Bear and Beautiful Strings
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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 (109+7).

Input

The first line of the input contains three space-separated integers n,m,g (0≤n,m≤105,n+m≥1,0≤g≤1).

Output

Print a single integer − the answer to the problem modulo 1000000007 (109+7).

Examples
Input
1 1 0
Output
2
Input
2 2 0
Output
4
Input
1 1 1
Output
0
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.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 1970 题。保留原作者与原赛事署名。