#D10716. Combine Two Elements
Combine Two Elements
Combine Two Elements
Problem
Given a pair of non-negative integers and non-negative integers , . I want to do as many of the following operations as possible.
- or $ B \ leq | a_i --b_i | \ leq Take out and delete the element $ i
- or $ B \ leq | (a_i + a_j)-(b_i + b_j) | Extract and delete the pair of j $ ()
Find the maximum number of operations.
Constraints
The input satisfies the following conditions.
- and
Input
The input is given in the following format.
...
All inputs are given as integers. , , are given on the first line, separated by blanks. The th pair and () are given in the second and subsequent lines, separated by blanks.
Output
Output the maximum number of operations on one line.
Examples
Input
5 3 5 7 2 13 1 1 1 2 9 2 4
Output
4
Input
10 7 12 34 70 36 0 12 50 76 46 33 45 61 21 0 1 24 3 98 41 23 84
Output
5
inputFormat
input satisfies the following conditions.
- and
Input
The input is given in the following format.
...
All inputs are given as integers. , , are given on the first line, separated by blanks. The th pair and () are given in the second and subsequent lines, separated by blanks.
outputFormat
Output
Output the maximum number of operations on one line.
Examples
Input
5 3 5 7 2 13 1 1 1 2 9 2 4
Output
4
Input
10 7 12 34 70 36 0 12 50 76 46 33 45 61 21 0 1 24 3 98 41 23 84
Output
5
样例
10 7 12
34 70
36 0
12 50
76 46
33 45
61 21
0 1
24 3
98 41
23 84
5