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 ~A~ and ~B~ micrograms of sugar and the second cup of tea must have between ~C~ and ~D~ micrograms of sugar, compute the number of distinct ways Tudor can prepare the cups of tea.
~1 \le A \le B \le 10^7~
~1 \le C \le D \le 10^7~
In tests worth 5 marks, ~B \le 10^2~ and ~D \le 10^2~.
The input will consist of a single line containing four space-separated integers, ~A~, ~B~, ~C~, and ~D~.
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.