Sun Protection
Sunbathing Cows
There are C cows who want to sunbathe. The i-th cow requires sunlight intensity between minSPF[i] and maxSPF[i].
Each cow must apply sunscreen before sunbathing. There are L types of sunscreen. Applying the i-th type stabilizes the sunlight intensity received at SPF[i]. The i-th sunscreen has cover[i] bottles.
Find the maximum number of cows that can be satisfied for sunbathing.
Input Format
The first line contains integers C and L.
The next C lines each contain minSPF[i] and maxSPF[i] for a cow.
The following L lines each contain SPF[i] and cover[i] for a sunscreen type.
Data in each line is separated by spaces.
Output Format
Output an integer representing the maximum number of cows that can be satisfied.
Constraints
1 ≤ C, L ≤ 2500
1 ≤ minSPF ≤ maxSPF ≤ 1000
1 ≤ SPF ≤ 1000
Sample Input
3 2
3 10
2 5
1 5
6 2
4 1
Sample Output
2
Comments