Drama

Count the number of valid pyramid colourings of an H by N grid with exactly N black cells, modulo 10^9+7.

Hard9CombinatoricsDynamic programmingMathNo attempts yetTime limit2sMemory limit512 MB

Problem

Vera has a grid with HH rows and NN columns. Rows are numbered 1 to HH from the top, and columns are numbered 1 to NN from the left. The cell in row rr and column cc is written (r,c)(r, c). Every cell is coloured white or black. A colouring is a pyramid if it satisfies all of the following.

  • Exactly NN cells are black.
  • (1,1)(1, 1) is black.
  • If (r,a)(r, a) and (r,b)(r, b) are both black, then (r,k)(r, k) is black for every kk with a<k<ba < k < b.
  • If (r,c)(r, c) is black and (r1,c)(r - 1, c) exists, then (r1,c)(r - 1, c) is black.
  • If (r,c)(r, c) is black and no k<ck < c has (r,k)(r, k) black, then (r+1,c)(r + 1, c), if it exists, is white.

Two pyramids are different if at least one cell has a different colour in them. Count the different pyramids modulo 109+710^9 + 7.

Input

The first line contains two integers HH and NN separated by a space. (1H,N1051 \le H, N \le 10^5)

Output

Print one line with the number of different pyramids modulo 109+710^9 + 7.

Hint

For H=2H = 2 and N=6N = 6 there are seven pyramids, shown below. # is a black cell and . is a white cell.

###### ####.. ####.. #####. #####. #####. #####.
...... .##... ..##.. .#.... ..#... ...#.. ....#.