Dividing
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

The following rules define a kind of integer tuple - the Legend Tuple:
  •  (1, k) is always a Legend Tuple, where k is an integer.
  • if (n, k) is a Legend Tuple, (n + k, k) is also a Legend Tuple.
  • if (n, k) is a Legend Tuple, (nk, k) is also a Legend Tuple.

We want to know the number of the Legend Tuples (n, k) where .

In order to avoid calculations of huge integers, report the answer modulo instead.

输入描述:

The input contains two integers N and K, .

输出描述:

Output the answer modulo .
示例1

输入

复制
3 3

输出

复制
8
示例2

输入

复制
3 9

输出

复制
14