Circular Coloring
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 128 M,其他语言256 M
Special Judge, 64bit IO Format: %lld

题目描述

Bobo considers (n + m) balls arranged in a circle.
The balls are numbered with where the ball i and the ball are adjacent.
Bobo would like to color n of his balls black and m of his balls white.
Bobo groups adjacent balls with same colors, and he determines the weight of the coloring as the product of the lengths of groups.
He would like to know the sum of the weight of the possible colorings, modulo .

输入描述:

The input consists of several test cases and is terminated by end-of-file.
Each test case contains two integers n and m.

输出描述:

For each test case, print an integer which denotes the result.
示例1

输入

复制
1 2
2 3
5000 5000

输出

复制
6
40
975597525

说明

For the second sample, there are 10 possible colorings (listed below).
The number followed is the corresponding weight.

* `BBWWW` (6)
* `BWBWW` (2)
* `BWWBW` (2)
* `BWWWB` (6)
* `WBBWW` (6)
* `WBWBW` (2)
* `WBWWB` (2)
* `WWBBW` (6)
* `WWBWB` (2)
* `WWWBB` (6)

备注:

* 
* The number of test cases does not exceed 5000.