atcoder#ARC111E. [ARC111E] Simple Math 3
[ARC111E] Simple Math 3
Score : points
Problem Statement
In this problem, you will be given test cases for each input.
Given integers , , , and , find the number of positive integers satisfying the following condition:
- None of the integers between and (inclusive) is a multiple of .
We can prove from the constraints that the count is finite.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain the answer for the -th case (, , , ).
2
3 1 2 5
99 101 103 105
1
25
The pairs for the first case are listed below. We can see that only satisfies the condition.