Foo gave Bar N lines in the 2D plane, of the form ax+by+c=0. He decided to ask Q questions to Bar. In every question, he would select a line, and Bar will have to find out how many lines are perpendicular to the line selected by Foo. Help Bar in answering the questions.
Input:
First line contains a single integer N - the total number of lines given by Foo to Bar.
N lines follow - each line contains 3 space separated integers: a, b and c, representing the line ax+by+c=0.
Next line contains a single integer Q - the number of questions asked by Foo to Bar.
Q lines follow - each line contains an index between 1 and N (inclusive) - denoting the line selected by Foo.
Output:
Print the number of lines perpendicular to the line selected by Foo.
Print the answer to each question asked by Foo on a new line.
Constraints:
1 ≤ N ≤ 105
10-9 ≤ a, b, c ≤ 109
1 ≤ Q ≤ 105
Note: All triplets (a, b, c) in the input denote valid straight lines.
Lines 1 and 2 are perpendicular to each other.