Problem F
Final Exam
In the final round of the Hunter Exam, candidates must prove their ability to process big data as well as geometry knowledge.
In the Examination Hall, the candidates can find three piles of segments:
-
The first pile has
segments, and the -th segment has length . -
The second pile has
segments, and the -th segment has length . -
The third pile has
segments, and the -th segment has length .
The candidates must quickly select three segments, one segment from each pile, such that:
-
The three segments can be used to form a right triangle.
-
The segment chosen from the third pile must be longest.
As the organizer of the Hunter Exam, you need to make sure that the difficulty is right for the final round. Thus you want to know the number of ways to select three segments, satisfying the conditions above?
Input
The first line of the input contains exactly three integers:
The second line of the input contains exactly
The third line of the input contains exactly
The fourth line of the input contains exactly
All the lengths of the segments are between
Output
Print exactly one integer — the number of triplets.
Explanation of sample test
There are
Selecting
Sample Input 1 | Sample Output 1 |
---|---|
3 2 3 3 4 5 4 3 5 5 3 |
4 |