#P3990. [SHOI2013] 超级跳马

    ID: 2879 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2013各省省选上海前缀和矩阵乘法构造

[SHOI2013] 超级跳马

Description

Given an nn-row by mm-column board, a knight wants to jump from the top-left corner to the bottom-right corner. At each step, it jumps to the right by an odd number of columns and lands in the same row or an adjacent row. During the jump, the knight must not leave the board. For example, when n=3n = 3, m=10m = 10, the figure below shows a valid sequence of jumps.

Find the number of different jump sequences modulo 3001130\,011.

Input Format

A single line containing two positive integers nn, mm, representing the size of the board.

Output Format

Output a single line containing one integer, the number of jump sequences modulo 3001130\,011.

3 5
10

Hint

  • For 10%10\% of the testdata, 1n101 \leq n \leq 10, 2m102 \leq m \leq 10.
  • For 50%50\% of the testdata, 1n101 \leq n \leq 10, 2m1052 \leq m \leq 10^5.
  • For 80%80\% of the testdata, 1n101 \leq n \leq 10, 2m1092 \leq m \leq 10^9.
  • For 100%100\% of the testdata, 1n501 \leq n \leq 50, 2m1092 \leq m \leq 10^9.

Translated by ChatGPT 5