Mike Sees The Storm (Large)
Time limit1sMemory limit1024 MB
Sum the K-th power of the maximum prefix value over all balanced +1/-1 walks of length 2N from 0, modulo 1e9+7.
- Level
Hard9 of 10
- Topics
- Math, Combinatorics, Number theory
- Solved
- No attempts yet
Problem
The board initially shows . Mike repeats one of two operations to build a sequence.
- If the number on the board is , erase it and write .
- If the number on the board is , erase it and write .
The two operations may be performed in any order, but each must be performed exactly times. Let be the sequence of numbers written on the board, in order.
For every order in which Mike can perform the operations, take the maximum of the resulting sequence, raise it to the -th power, and add these values together. Print the sum modulo 1 000 000 007.
Input
The first line contains two integers and (, ).
Output
Print the sum of the -th powers of the maximum of each sequence Mike can obtain, modulo 1 000 000 007.