100 atcoder#ABC131C. [ABC131C] Anti-Division

[ABC131C] Anti-Division

Score : 300300 points

Problem Statement

You are given four integers AA, BB, CC, and DD. Find the number of integers between AA and BB (inclusive) that can be evenly divided by neither CC nor DD.

Constraints

  • 1AB10181\leq A\leq B\leq 10^{18}
  • 1C,D1091\leq C,D\leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

AA BB CC DD

Output

Print the number of integers between AA and BB (inclusive) that can be evenly divided by neither CC nor DD.

4 9 2 3
2

55 and 77 satisfy the condition.

10 40 6 8
23
314159265358979323 846264338327950288 419716939 937510582
532105071133627368