#P15220. [SWERC 2017] Macarons

[SWERC 2017] Macarons

题目描述

Pierre is famous for his macarons. He makes round macarons, stored in square boxes of size 1×1 1 \times 1 , and oval-shaped macarons, stored in rectangular boxes of size 1×2 1 \times 2 (or, rotated, in rectangular boxes of size 2×1 2 \times 1 ). For the purpose of a buffet, Pierre wishes to tile a rectangular table of size N×M N \times M with the two kinds of macarons, meaning that the table must be completely full, with no empty space left. The width N N of the table is small, for the guest to be able to grab the macarons easily, and the length M M of the table is large, to accommodate a huge number of guests. To keep the table pretty, the orientation of macarons should always be aligned with the sides of the table.

Pierre wishes to know how many ways there are to tile the table. Can you help him?

输入格式

The input consists of the following integers:

  • the value of N N , an integer, on the first line;
  • the value of M M , an integer, on the second line.

输出格式

The output should consist of the total number of tilings, given modulo 109 10^9 , on a single line.

2
2
7
2
4
71

提示

Limits

The input satisfies 1N8 1 \leq N \leq 8 and 1M1018 1 \leq M \leq 10^{18} .