## ICPC SWERC 2017 C - Macarons

View as PDF

Points: 17
Time limit: 3.0s
Memory limit: 1G

Problem type

Pierre is famous for his macarons. He makes round macarons, stored in square boxes of size , and oval-shaped macarons, stored in rectangular boxes of size (or, rotated, in rectangular boxes of size ). For the purpose of a buffet, Pierre wishes to tile a rectangular table of size with the two kinds of macarons, meaning that the table must be completely full, with no empty space left. The width of the table is small, for the guest to be able to grab the macarons easily, and the length 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?

#### Input Specification

The input consists of the following integers:

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

#### Constraints

The input satisfies and .

#### Output Specification

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

#### Sample Input 1

2
2

#### Sample Output 1

7

#### Sample Input 2

2
4

#### Sample Output 2

71