PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000327. Các dãy chia hết liên tiếp (Multiple Sequences)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Các dãy chia hết liên tiếp (Multiple Sequences)

Multiple Sequences

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers NN and MM, count sequences of integers A1,A2,…,ANA_1,A_2,\ldots,A_N satisfying:

  • 1≤Ai≤M1\le A_i\le M for every 1≤i≤N1\le i\le N;
  • Ai+1A_{i+1} is divisible by AiA_i for every 1≤i<N1\le i<N (equality is allowed).

Two sequences are different if at least one position differs. Output the count modulo 998244353998244353.

Input

A single line containing N,MN,M.

Output

Print the count of valid sequences modulo 998244353998244353.

Subtasks

  • Subtask 1 (20 points): 1≤N≤61\le N\le6; 1≤M≤601\le M\le60.
  • Subtask 2 (30 points): 1≤N≤10001\le N\le1000; 1≤M≤100001\le M\le10000.
  • Subtask 3 (50 points): 1≤N,M≤2000001\le N,M\le200000.

Examples

Example 1

Input

3 4

Output

13

Explanation

Group by the final term A3A_3: the numbers of valid sequences ending in 1,2,3,41,2,3,4 are respectively 1,3,3,61,3,3,6. Their sum is 1313.

Example 2

Input

20 30

Output

71166

Explanation

Summing the combinatorial counts for all final terms from 11 to 3030 gives 7116671166 modulo 998244353998244353.

Example 3

Input

200000 200000

Output

835917264

Explanation

This case reaches both maximum bounds; prime factorization and modular combinations are required instead of enumerating sequences.