CF712D.Memory and Scores

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score aa and Lexa starts with score bb . In a single turn, both Memory and Lexa get some integer in the range [k;k][-k;k] (i.e. one integer among k,k+1,k+2,...,2,1,0,1,2,...,k1,k-k,-k+1,-k+2,...,-2,-1,0,1,2,...,k-1,k ) and add them to their current scores. The game has exactly tt turns. Memory and Lexa, however, are not good at this game, so they both always get a random integer at their turn.

Memory wonders how many possible games exist such that he ends with a strictly higher score than Lexa. Two games are considered to be different if in at least one turn at least one player gets different score. There are (2k+1)2t(2k+1)^{2t} games in total. Since the answer can be very large, you should print it modulo 109+710^{9}+7 . Please solve this problem for Memory.

输入格式

The first and only line of input contains the four integers aa , bb , kk , and tt ( 1<=a,b<=1001<=a,b<=100 , 1<=k<=10001<=k<=1000 , 1<=t<=1001<=t<=100 ) — the amount Memory and Lexa start with, the number kk , and the number of turns respectively.

输出格式

Print the number of possible games satisfying the conditions modulo 10000000071000000007 ( 109+710^{9}+7 ) in one line.

输入输出样例

  • 输入#1

    1 2 2 1
    

    输出#1

    6
    
  • 输入#2

    1 1 1 2
    

    输出#2

    31
    
  • 输入#3

    2 12 3 1
    

    输出#3

    0
    

说明/提示

In the first sample test, Memory starts with 11 and Lexa starts with 22 . If Lexa picks 2-2 , Memory can pick 00 , 11 , or 22 to win. If Lexa picks 1-1 , Memory can pick 11 or 22 to win. If Lexa picks 00 , Memory can pick 22 to win. If Lexa picks 11 or 22 , Memory cannot win. Thus, there are 3+2+1=63+2+1=6 possible games in which Memory wins.

首页