Nastya Studies Informatics

题意翻译

## 题目描述 $Nastya$ 了解到 $GCD(a,\ b)$ 用于表示 $a$ 和 $b$ 的最大公约数, $LCM(a,\ b)$ 用于表示 $a$ 和 $b$ 的最小公倍数。 给出整数 $x$ 和 $y$ ,请你帮她求出当 $l \leqslant a,\ b \leqslant r$ 时,有多少对 $(a,\ b)$ 能同时满足 $GCD(a,\ b) = x$ 且 $LCM(a,\ b) = y$ 。注意,当 $a \neq b$ 时, $(a,\ b)$ 和 $(b,\ a)$ 是不一样的。 ## 输入格式 仅 $1$ 行,有 $4$ 个整数,分别表示取值范围是 $l$ 到 $r$ ,以及给出的 $x$ 和 $y$ 。 (数据范围: $1 \leqslant l \leqslant r \leqslant 10^9$ , $1 \leqslant x \leqslant y \leqslant 10^9$ ) ##输出格式 仅 $1$ 个整数,表示满足要求的 $(a,\ b)$ 有多少对。 ##提示与说明 - 第 $1$ 组样例的解释: 满足要求的 $(a,\ b)$ 有 $(1,\ 2)$ 和 $(2,\ 1)$ 。 - 第 $2$ 组样例的解释: 满足要求的 $(a,\ b)$ 有 $(1,\ 12)$ , $(12,\ 1)$ , $(3,\ 4)$ , $(4,\ 3)$ 。 - 第 $3$ 组样例的解释: 没有满足要求的 $(a,\ b)$ 。虽然 $(3,\ 30)$ 满足 $GCD(3,\ 30) = x$ 和 $LCM(3,\ 30) = y$ ,但它们都不在指定范围内。 感谢@Sooke 提供翻译

题目描述

Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she solved all the tasks momentarily and now suggests you to solve one of them as well. We define a pair of integers $ (a,b) $ good, if $ GCD(a,b)=x $ and $ LCM(a,b)=y $ , where $ GCD(a,b) $ denotes the [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) of $ a $ and $ b $ , and $ LCM(a,b) $ denotes the [least common multiple](https://en.wikipedia.org/wiki/Least_common_multiple) of $ a $ and $ b $ . You are given two integers $ x $ and $ y $ . You are to find the number of good pairs of integers $ (a,b) $ such that $ l<=a,b<=r $ . Note that pairs $ (a,b) $ and $ (b,a) $ are considered different if $ a≠b $ .

输入输出格式

输入格式


The only line contains four integers $ l,r,x,y $ ( $ 1<=l<=r<=10^{9} $ , $ 1<=x<=y<=10^{9} $ ).

输出格式


In the only line print the only integer — the answer for the problem.

输入输出样例

输入样例 #1

1 2 1 2

输出样例 #1

2

输入样例 #2

1 12 1 12

输出样例 #2

4

输入样例 #3

50 100 3 30

输出样例 #3

0

说明

In the first example there are two suitable good pairs of integers $ (a,b) $ : $ (1,2) $ and $ (2,1) $ . In the second example there are four suitable good pairs of integers $ (a,b) $ : $ (1,12) $ , $ (12,1) $ , $ (3,4) $ and $ (4,3) $ . In the third example there are good pairs of integers, for example, $ (3,30) $ , but none of them fits the condition $ l<=a,b<=r $ .