#P1999. 高维正方体

高维正方体

Description

Elements in 00-dimensional space are points, which is beyond doubt.

  • 22 elements of 00-dimensional space can form a 11-dimensional element, a line segment.
  • 44 elements of 11-dimensional space can form a 22-dimensional element, a square.
  • 66 elements of 22-dimensional space can form a 33-dimensional element, a cube.
  • 88 elements of 33-dimensional space can form a 44-dimensional element, a hypercube.

  • In a square, there are 44 points (vertices), 44 line segments (edges), and 11 square.
  • In a cube, there are 88 points (vertices), 1212 line segments (edges), 66 squares (faces), and 11 cube.

Our problem is: given aa and bb, find how many bb-dimensional elements are contained in an aa-dimensional element. The answer may be large; output it modulo 109+710^9+7.

Input Format

Two integers a,ba,b, separated by a space.

Output Format

One integer, the answer.

3 1
12

Hint

Sample Explanation

The 33-dimensional element is a cube, and the 11-dimensional element is a line segment. What is required is the number of edges in a cube, which is 1212.

Constraints

  • For 5%5\% of the data, a,b1a,b \le 1.
  • For 10%10\% of the data, a,b2a,b \le 2.
  • For 20%20\% of the data, a,b3a,b \le 3.
  • For 35%35\% of the data, a,b4a,b \le 4.
  • For 70%70\% of the data, a,b1000a,b \le 1000.
  • For 100%100\% of the data, 0a,b1000000 \le a,b \le 100000.

In addition, for 15%15\% of the testdata, b=0b=0; for 10%10\% each, b=1b=1 or b=2b=2.

Tip

It is not guaranteed that aba \ge b.

Translated by ChatGPT 5