Problem Statement | |||||||||||||
Consider the following set (see notes for clarification):S = { p/q | w <= p <= x, y <= q <= z }Given w, x, y, and z return the number of distinct elements in S. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | S is the set of all rational numbers whose numerators are between w and x inclusive, and whose denominators are between y and z inclusive. | ||||||||||||
Constraints | |||||||||||||
- | x and z will be between 1 and 100, inclusive. | ||||||||||||
- | w will be between 1 and x, inclusive. | ||||||||||||
- | y will be between 1 and z, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|