Larry is looking for a mate, but since his is such a busy man he is employing two of his friends to help him.
There are candidate mates, each of which have two values: a beauty value and a personality value .
One of Larry's friends cares about both values, and will only consider a mate for larry if their beauty is at least and their personality is at least .
The other of his friends cares about the overall value, and will only consider a mate for Larry if their beauty value + their personality value is at least .
Larry doesn't know his friends' values of , , and though, so given triplets of integers , he wants you to detemine how many mates will be considered a candidate by both of his friends. Can you help him?
Input Specification
The first line will contain two integers and .
The next lines will contain two values
The next lines will contain three values , , and .
Output Specification
You are to output lines: the number of mates considered to be a candidate by both of his friends for each query.
Subtasks
Subtask 1 (2%)
Subtask 2 (20%)
,
Subtask 3 (21%)
,
Subtask 4 (57%)
No additional constraints.
Sample Input
5 4
35 100
70 70
45 15
80 40
20 95
20 50 120
10 10 100
60 60 80
0 100 100
Sample Output
2
4
1
1
Comments