AtCoder Beginner Contest 131
C
Anti-Division
AtCoder
⌀ 518
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given four integers $A$, $B$, $C$, and $D$. Find the number of integers between $A$ and $B$ (inclusive) that can be evenly divided by neither $C$ nor $D$.

翻译中…

Constraints

翻译中…
  • $1\leq A\leq B\leq 10^{18}$
  • $1\leq C,D\leq 10^9$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

A B C D

翻译中…

Output

翻译中…

Print the number of integers between $A$ and $B$ (inclusive) that can be evenly divided by neither $C$ nor $D$.

翻译中…

样例

Input #1
4 9 2 3
Output #1
2
$5$ and $7$ satisfy the condition.
Input #2
10 40 6 8
Output #2
23
Input #3
314159265358979323 846264338327950288 419716939 937510582
Output #3
532105071133627368
题目信息
题号
abc131_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。