Bánh Bò

시간 제한1초메모리 제한1024 MB

요약
r이 6의 배수, c가 7의 배수인 이진 격자에서 모든 6×7 부분격자의 빨간 칸 수가 같도록 채우는 경우의 수를 센다.
난이도

어려움10점 중 8점

유형
조합론, 수학, 동적 계획법, 정수론
정답자
아직 제출이 없습니다

문제

Ever since the Earth got destroyed, Trillian has been missing some Earth delicacies. Today, she had the spaceship’s food machine generate for her a Vietnamese delicacy she once enjoyed: bánh bò hấp (steamed chewy sponge cake).

Trillian has an unlimited number of bánh bò hấp pieces. Each piece of bánh bò hấp is either red or white. She wants to assemble rcrc pieces of bánh bò hấp into a grid with dimensions r×cr \times c, where each cell contains a single piece of bánh bò hấp. Thus, there are exactly 2rc2^{rc} distinct ways to assemble bánh bò hấp into an r×cr \times c grid, since we consider pieces of the same color to be identical.

We say an assembly of bánh bò hấp is uniform if all 6×76 \times 7 subgrids have the same number of red pieces. Consequently, in a uniform bánh bò hấp assembly, all 6×76 \times 7 subgrids have the same number of white pieces as well. Note that an r×cr \times c grid has (r−5)(c−6)(r - 5)(c - 6) subgrids of dimensions 6×76 \times 7.

For example, Figure D.1 illustrates a uniform assembly of 7×87 \times 8 pieces of bánh bò hấp, where shaded cells represent red bánh bò hấp pieces and unshaded cells represent white bánh bò hấp pieces. Figure D.2 shows that all four 6×76 \times 7 subgrids have 66 red pieces and 3636 white pieces.

Figure D.1: An example of uniform bánh bò hấp assembly.

Figure D.2: All four 6×76 \times 7 subgrids of the uniform bánh bò hấp assembly illustrated in Figure D.1.

Given rr and cc, where rr is a multiple of 66 and cc is a multiple of 77, Trillian would like to calculate the number of possible uniform bánh bò hấp assemblies modulo 998,244,353998\\, 244\\, 353.

입력

Input consists of a single line containing two integers rr and cc (6≤r≤66,6666 ≤ r ≤ 66\\, 666; rr is a multiple of 66; 7≤c≤77,7777 ≤ c ≤ 77\\, 777; cc is a multiple of 77).

출력

Output the number of possible uniform bánh bò hấp assemblies modulo 998,244,353998\\, 244\\, 353.

예제4

  1. 예제 1

    입력
    6 7
    
    예상 출력
    780136139
    
  2. 예제 2

    입력
    12 14
    
    예상 출력
    22889737
    
  3. 예제 3

    입력
    12 42
    
    예상 출력
    96403614
    
  4. 예제 4

    입력
    42 14
    
    예상 출력
    94940316