This is another exercise about Fermat’s last theorem, which was explained in the exercise P36430: “Fermat’s last theorem (1)”
Write a program that, given four natural numbers a,b,c,d with a≤ b and c≤ d, prints the number of solutions to the equation
x^{2} + y^{2} = z^{2} |
such that a ≤ x ≤ b and c ≤ y ≤ d.
Input
Input has several cases. Each case consists of four natural numbers a, b, c, d such that a≤ b and c≤ d.
Output
For every case, print in a line the number of solutions to the equation
x^{2} + y^{2} = z^{2} |
that fulfill a ≤ x ≤ b and c ≤ y ≤ d.
Input
2 5 4 13 1 1 2 3
Output
2 0