303997: CF768F. Barrels and boxes

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Barrels and boxes

题意翻译

有 $w$ 箱酒,$f$ 箱食物。 现在要把这些箱子摞成相邻的若干堆,要求每一堆都必须是同类型的箱子,且相邻堆类型不同。 堆的高度定义为所有的箱子数。问所有**用酒箱子做成的堆**高度都大于 $h$ 的概率。 $f,w,h\leq 10^5$ 。

题目描述

Tarly has two different type of items, food boxes and wine barrels. There are $ f $ food boxes and $ w $ wine barrels. Tarly stores them in various stacks and each stack can consist of either food boxes or wine barrels but not both. The stacks are placed in a line such that no two stacks of food boxes are together and no two stacks of wine barrels are together. The height of a stack is defined as the number of items in the stack. Two stacks are considered different if either their heights are different or one of them contains food and other contains wine. Jon Snow doesn't like an arrangement if any stack of wine barrels has height less than or equal to $ h $ . What is the probability that Jon Snow will like the arrangement if all arrangement are equiprobably? Two arrangement of stacks are considered different if exists such $ i $ , that $ i $ -th stack of one arrangement is different from the $ i $ -th stack of the other arrangement.

输入输出格式

输入格式


The first line of input contains three integers $ f $ , $ w $ , $ h $ ( $ 0<=f,w,h<=10^{5} $ ) — number of food boxes, number of wine barrels and $ h $ is as described above. It is guaranteed that he has at least one food box or at least one wine barrel.

输出格式


Output the probability that Jon Snow will like the arrangement. The probability is of the form ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF768F/ae456f9650d5b3ca46e54c303d07fec088f6ad5e.png), then you need to output a single integer $ p·q^{-1}\ mod\ (10^{9}+7) $ .

输入输出样例

输入样例 #1

1 1 1

输出样例 #1

0

输入样例 #2

1 2 1

输出样例 #2

666666672

说明

In the first example $ f=1 $ , $ w=1 $ and $ h=1 $ , there are only two possible arrangement of stacks and Jon Snow doesn't like any of them. In the second example $ f=1 $ , $ w=2 $ and $ h=1 $ , there are three arrangements. Jon Snow likes the (1) and (3) arrangement. So the probabilty is ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF768F/c171d3ec3c02b9089b571e24a262c7ab1c15c85e.png). ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF768F/3e5447e34c48fd4c4bc2060eccebc67dc1ee4bf4.png)

Input

题意翻译

有 $w$ 箱酒,$f$ 箱食物。 现在要把这些箱子摞成相邻的若干堆,要求每一堆都必须是同类型的箱子,且相邻堆类型不同。 堆的高度定义为所有的箱子数。问所有**用酒箱子做成的堆**高度都大于 $h$ 的概率。 $f,w,h\leq 10^5$ 。

加入题单

算法标签: