FIICode 2024 Open | Tree Count

This was the problem page during the contest. Access the current page here.
Time limit: 2s Memory limit: 256MB Input: Output:

The history of all hitherto existing society is the history of the struggle for better LOL ranks.

— Hungry Santa, 1848

We start with a binary tree consisting of only one node, namely its root. At each step, we can choose a leaf of the current tree and create two new children in that node, namely the left one and the right one. Find the total number of trees of height hh that can be obtained after applying nn such operations. The result shall be printed modulo 109+710^9 + 7.

The height of a tree is defined as the length (that is, number of edges) of the longest path starting from its root and ending in one of its leaves.

Two binary trees, T1T_1 and T2T_2, each having more than one node, are considered equal if the left subtree of T1T_1 equals the left subtree of T2T_2 and the right subtree of T1T_1 equals the right subtree of T2T_2. Two binary trees, each having exactly one node, are always considered equal.

Input

The first line contains the numbers nn (0n5000 \le n \le 500) and hh (0h5000 \le h \le 500).

Output

The first line contains the required number modulo 109+710^9 + 7.

Example 1

stdin

5 3

stdout

6

Example 2

stdin

314 100

stdout

569329628

Log in or sign up to be able to send submissions!