$P(x)$ を、$1 < y < x$ かつ $y^3 \equiv 1 \pmod x$ を満たす $y$ の個数と定義します。
$n$ 以下の正整数のうち、$P(x) = m$ を満たすものの個数を求めてください。
入力
一行に2つの整数 $n, m$ が与えられます。
出力
答えを1つの整数で出力してください。
子タスク
| テストケース番号 | $n$ | $m$ |
|---|---|---|
| $1$ | $\le 2\times 10^{10}$ | $=666$ |
| $2$ | $\le 10^3$ | |
| $3$ | $\le 10^5$ | |
| $4$ | $\le 10^6$ | |
| $5$ | $\le 3\times 10^6$ | |
| $6$ | $\le 5\times 10^6$ | |
| $7$ | $\le 10^7$ | |
| $8$ | $\le 10^8$ | $\ge 300$ |
| $9$ | $\le 5\times 10^8$ | |
| $10$ | $\le 10^9$ | |
| $11$ | $\le 5\times 10^9$ | $\ge 200$ |
| $12$ | $\le 10^{10}$ | |
| $13$ | $=0$ | |
| $14$ | $\le 2\times 10^{10}$ | |
| $15$ | $\le 10^8$ | |
| $16$ | $\le 5\times 10^8$ | |
| $17$ | $\le 10^9$ | |
| $18$ | $\le 5\times 10^9$ | |
| $19$ | $\le 10^{10}$ | |
| $20$ | $\le 2\times 10^{10}$ |
$100\%$ のデータについて、$1 < n \le 2 \times 10^{10}$、$0 \le m < n$ です。
入出力例
入力 1
10 0
出力 1
8
入力 2
100000000 242
出力 2
24038