CF336D.Vasily the Bear and Beautiful Strings

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasily the Bear loves beautiful strings. String ss is beautiful if it meets the following criteria:

  1. String ss only consists of characters 00 and 11 , at that character 00 must occur in string ss exactly nn times, and character 11 must occur exactly mm times.
  2. We can obtain character gg from string ss with some (possibly, zero) number of modifications. The character gg 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 10000000071000000007 (109+7)(10^{9}+7) .

输入格式

The first line of the input contains three space-separated integers n,m,gn,m,g (0<=n,m<=10^{5},n+m>=1,0<=g<=1) .

输出格式

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

输入输出样例

  • 输入#1

    1 1 0
    

    输出#1

    2
    
  • 输入#2

    2 2 0
    

    输出#2

    4
    
  • 输入#3

    1 1 1
    

    输出#3

    0
    

说明/提示

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.

首页