Sim2 | matchingcolors

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

Elly has a squared sheet of paper with NN rows and MM columns. The girl wants to fill each of the squares with red or blue. She insists that each square with a certain color has at least one more square with the same color in the same row or the same column ("so it does not feel alone").

For each square it is enough to have a matching-by-color square either оn the same row OR on the same column - but not necessarily both (although this is allowed). It is also allowed there to be more than one matching square in the same row or column - for example an entire row filled with red is okay. It is not required that both colors are used - thus the whole paper being blue for example might be a valid filling.

The girl now wonders in how many ways she can fill the sheet of paper. Two ways of filling are considered different, if there is a cell that is colored red in one of filling and blue in another.

Input

On the only line of the standard input are given two integers NN and MM - the number of rows and columns of the paper, respectively.

Output

On the standard output, print one integer: the number of different ways to fill the paper. Since the answer can be rather large, print only its remainder when divided by 1 000 000 0071\ 000\ 000\ 007.

Constraints

  • 1N,M501 ≤ N, M ≤ 50
  • In 30% of the test cases 1N,M51 ≤ N, M ≤ 5
  • In 60% of the test cases min(N,M)7min(N, M) ≤ 7

Example

stdin

3 3

stdout

284

stdin

5 4

stdout

898416

stdin

13 17

stdout

390317257

stdin

42 42

stdout

193467102

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