#NOMURA2020F. Sorting Game

Sorting Game

Score : 10001000 points

Problem Statement

Takahashi and Snuke came up with a game that uses a number sequence, as follows:

  • Prepare a sequence of length MM consisting of integers between 00 and 2N12^N-1 (inclusive): a=a1,a2,,aMa = a_1, a_2, \ldots, a_M.
  • Snuke first does the operation below as many times as he likes:
    • Choose a positive integer dd, and for each ii (1iM)(1 \leq i \leq M), in binary, set the dd-th least significant bit of aia_i to 00. (Here the least significant bit is considered the 11-st least significant bit.)
  • Choose a positive integer dd, and for each ii (1iM)(1 \leq i \leq M), in binary, set the dd-th least significant bit of aia_i to 00. (Here the least significant bit is considered the 11-st least significant bit.)
  • After Snuke finishes doing operations, Takahashi tries to sort aa in ascending order by doing the operation below some number of times. Here aa is said to be in ascending order when aiai+1a_i \leq a_{i + 1} for all ii (1iM1)(1 \leq i \leq M - 1).
    • Choose two adjacent elements of aa: aia_i and ai+1a_{i + 1}. If, in binary, these numbers differ in exactly one bit, swap aia_i and ai+1a_{i + 1}.
  • Choose two adjacent elements of aa: aia_i and ai+1a_{i + 1}. If, in binary, these numbers differ in exactly one bit, swap aia_i and ai+1a_{i + 1}.

There are 2NM2^{NM} different sequences of length MM consisting of integers between 00 and 2N12^N-1 that can be used in the game.

How many among them have the following property: if used in the game, there is always a way for Takahashi to sort the sequence in ascending order regardless of Snuke's operations? Find the count modulo (109+7)(10^9 + 7).

Constraints

  • All values in input are integers.
  • 1N50001 \leq N \leq 5000
  • 2M50002 \leq M \leq 5000

Input

Input is given from Standard Input in the following format:

NN MM

Output

Print the number, modulo (109+7)(10^9 + 7), of sequences with the property: if used in the game, there is always a way for Takahashi to sort the sequence in ascending order regardless of Snuke's operations.

2 5
352

Consider the case a=1,3,1,3,1a = 1, 3, 1, 3, 1 for example.

  • When the least significant bit of each element of aa is set to 00, a=0,2,0,2,0a = 0, 2, 0, 2, 0;
  • When the second least significant bit of each element of aa is set to 00, a=1,1,1,1,1a = 1, 1, 1, 1, 1;
  • When the least two significant bits of each element of aa are set to 00, a=0,0,0,0,0a = 0, 0, 0, 0, 0.

In all of the cases above and the case when Snuke does no operation to change aa, we can sort the sequence by repeatedly swapping adjacent elements that differ in exactly one bit. Thus, this sequence has the property: if used in the game, there is always a way for Takahashi to sort the sequence in ascending order regardless of Snuke's operations.

2020 530
823277409