## An Animal Contest 4 P3 - Snowy Slopes

View as PDF

Points: 10
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

The Alpine Acres Crest ski company wants to decide where to build its new exclusive Christmas ski slope! The area that the company owns can be modelled as an infinite -dimensional vertical plane.

Moreover, the skiing company has already built potential endpoints for the ski slopes at points where represents the horizontal distance from the origin and represents the vertical distance.

In addition to having built potential endpoints, the company also surveyed eager skiers to see what steepness they prefer. The results of the surveys showed that there were steepnesses that were popular, with the -th steepness being represented with the integers and .

Being the company's loyal planner, you are tasked with finding the number of pairs of endpoints that can be possible slopes. Two points are a possible slope if there is at least popular steepness such that the two points form a line with a gradient equal to .

The gradient of a line joined by two points and is equal to .

#### Constraints    All are distinct.

All are distinct.

Neither nor will be .

#### Input Specification

The first line contains two space-separated integers and , the number of possible endpoints and the number of steepnesses respectively.

The next lines contain two integers and , the coordinates of the -th point.

The final lines contain two integers and , the -th preferred steepness.

#### Output Specification

Output one integer, the number of pairs of endpoints that can be possible slopes.

#### Sample Input

3 4
1 2
4 4
7 1
-1 1
2 1
4 6
-2 2

#### Sample Output

2

#### Explanation

The line intersects points and . The points and are intersected by the line . Thus, there are two possible slopes.