After playing petanque with his friends and beating them all the time, Benewski has decided to meditate for a little and quickly became interested in architecture and, most importantly, in shapes.
More exactly, he started drawing shapes made of straight line segments and decided to use them for his drawings.
Over time, his drawings became more and more complex, and he is now wondering, given one of his drawings, how many times a specific pattern appears in it.
A pattern is given by the coordinates of its segments that represent it. For a pattern to appear in a drawing, one should find the exact segments of the pattern up to translation in it. More exactly, a pattern occurs in the drawing if there exist numbers () such that, when shifting the pattern up by units on the axis and up by units on the axis, one finds a subset of the segments of the drawing.
Two occurences of a pattern are considered different if the sets of the segments that replicate the pattern are different.

One should notice that the pattern is replicated by segments , even though there are other segments crossing it.
Note also that the subset does not form the pattern, even though the shape appears in its structure.
Task
As Benewski's now busy with his new hobby (fencing), he counts on you to help him with this task.
You are given two integers and . Compute the sum of those two integers.
Input data
The first line contains , the number of segments that describe the patttern.
The next lines will each contain integers , representing the coordinates of the end points of each segment (i.e. the segment has endpoints and ).
The next line contains , the number of segments in the drawing.
The next lines will each contain integers , representing the coordinates of the end points of each segment (endpoints and ).
Output data
You need to write a single integer, representing the number of occurences of the pattern.
Constraints and clarifications
- All segments given in the drawing are distinct (there are no duplicates).
- All segments given in the pattern are distinct.
- .
- .
- .
- .
| # | Score | Constraints |
|---|---|---|
| 1 | 0 | Examples |
| 2 | 20 | |
| 3 | 10 | |
| 4 | 10 | |
| 5 | 20 | |
| 6 | 40 | No additional restrictions |
Example 1
stdin
2
2 0 0 2
1 0 2 2
6
4 5 7 2
5 0 7 4
5 0 3 3
4 1 2 3
2 1 3 4
3 1 4 3
stdout
1
Explanation
The first sample case is explained in figure .
Example 2
stdin
3
0 0 0 1
1 0 1 1
0 1 1 0
15
-1 2 -1 3
-1 3 0 2
0 2 0 3
0 3 1 2
1 2 1 3
1 3 2 2
2 2 2 3
2 3 -1 1
-1 1 -1 2
-1 2 0 1
0 1 0 2
0 2 1 1
1 1 1 2
1 1 2 2
2 1 2 2
stdout
5
Explanation

For the second sample case, notice how segments can be part of multiple patterns.
The 5 occurences of the pattern are
- ,
- ,
- ,
- ,
- .