Tudor hasn't had enough tea yet?
Tudor has prepared two cups of tea this time, each one with a certain number of micrograms of sugar. Tudor is superstitious and does not like it when the counts of micrograms of sugar are not relatively prime. The cups of tea must have integer micrograms of sugar.
Recall that two integers are relatively prime if their greatest common divisor is 1.
Given that the first cup of tea must have between and micrograms of sugar and the second cup of tea must have between and micrograms of sugar, compute the number of distinct ways Tudor can prepare the cups of tea.
In tests worth 5 marks, and .
The input will consist of a single line containing four space-separated integers, , , , and .
Output, on a single line, the number of distinct valid configurations of tea.
1 2 1 2
There are four possible ways to insert sugar, the only one of which is invalid when Tudor adds 2 micrograms of sugar to both.