Jeffrey bikes to school from his house every day. It's a great way to not pay the bus fee and get some exercise, but there is a problem: Jeffrey is scared of roads. Jeffrey has an innate fear of turn signals, stop signs, pavement, Goodyear tires, the colour green, and white paint. In order to minimize the amount of fear he experiences in his daily commute, find the least number of roads that Jeffrey must cross.
It is guaranteed that neither Jeffrey's house nor Jeffrey's school is directly on top of a road. Jeffrey is not a hobo. (Edit: Are you sure? :) )
Input Specification
The first line of input will have four integers
The next line will contain an integer A B C
. Each road will be represented by a line that is described by the equation
It is guaranteed that
Output Specification
Print out the minimum number of roads that Jeffrey must cross when travelling from his house,
Sample Input
-2 -2 2 2
4
0 1 -1
1 0 -1
2 4 8
3 3 -16
Sample Output
3
Comments