This problem is a programming version of Problem 210 from projecteuler.net
Consider the set of points with integer coordinates satisfying .
Consider three integers and let be the point and the point .
Let be the number of points in , so that the triangle has an obtuse angle, i.e. the largest angle satisfies .
Given , , and , what is ?
Input Format
The only line of the input contains exactly four space-separated integers: .
Constraints
- .
- .
- .
- .
- .
- .
- .
Output Format
Print one line containing the answer.
Sample Input 0
8 0 1 1
Sample Output 0
100
Sample Input 1
17 3 7 2
Sample Output 1
486
Sample Input 2
15 -13 10 1
Sample Output 2
364
Sample Input 3
17 -5 13 3
Sample Output 3
438