P1999 High-Dimensional Cube

Description

Elements in $0$-dimensional space are points, which is beyond doubt. - $2$ elements of $0$-dimensional space can form a $1$-dimensional element, a line segment. - $4$ elements of $1$-dimensional space can form a $2$-dimensional element, a square. - $6$ elements of $2$-dimensional space can form a $3$-dimensional element, a cube. - $8$ elements of $3$-dimensional space can form a $4$-dimensional element, a hypercube. … - In a square, there are $4$ points (vertices), $4$ line segments (edges), and $1$ square. - In a cube, there are $8$ points (vertices), $12$ line segments (edges), $6$ squares (faces), and $1$ cube. … Our problem is: given $a$ and $b$, find how many $b$-dimensional elements are contained in an $a$-dimensional element. The answer may be large; output it modulo $10^9+7$.

Input Format

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

Output Format

One integer, the answer.

Explanation/Hint

Sample Explanation The $3$-dimensional element is a cube, and the $1$-dimensional element is a line segment. What is required is the number of edges in a cube, which is $12$. Constraints - For $5\%$ of the data, $a,b \le 1$. - For $10\%$ of the data, $a,b \le 2$. - For $20\%$ of the data, $a,b \le 3$. - For $35\%$ of the data, $a,b \le 4$. - For $70\%$ of the data, $a,b \le 1000$. - For $100\%$ of the data, $0 \le a,b \le 100000$. In addition, for $15\%$ of the testdata, $b=0$; for $10\%$ each, $b=1$ or $b=2$. Tip It is not guaranteed that $a \ge b$. Translated by ChatGPT 5