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

#GL0000248. Dãy số khác thường (Unusual Sequences)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Dãy số khác thường (Unusual Sequences)

Unusual Sequences

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers x,yx,y, count nonempty finite sequences (a1,…,at)(a_1,\ldots,a_t) of positive integers with gcd⁡(a1,…,at)=x\gcd(a_1,\ldots,a_t)=x and a1+⋯+at=ya_1+\cdots+a_t=y. Two sequences differ if their lengths or a corresponding element differ. Output the answer modulo 109+710^9+7.

Input

One line contains positive integers x,yx,y.

Output

Print the number of valid sequences modulo 109+710^9+7.

Subtasks

  • Subtask 1 (20 points): 1≤x,y≤1001\le x,y\le 100.
  • Subtask 2 (30 points): 1≤x,y≤1000001\le x,y\le 100000.
  • Subtask 3 (50 points): 1≤x,y≤10000000001\le x,y\le 1000000000.

Examples

Example 1

Input

3 9

Output

3

Explanation

For x=3x=3, y=9y=9, after division by xx, there are 3 ordered compositions with GCD 11.

Example 2

Input

5 8

Output

0

Explanation

For x=5x=5, y=8y=8, the sum is not divisible by the required GCD, hence no sequence exists.