#include <bits/stdc++.h>
using namespace std;
bool jolmetsz(long long a, long long b, long long c, long long x1, long long y1,
              long long x2, long long y2) {
  return -c - a * x1 < b * y1 && -c - a * x2 > b * y2;
}
int main() {
  long long x1, x2, y1, y2, n, db = 0;
  cin >> x1 >> y1 >> x2 >> y2 >> n;
  if (y2 < y1) {
    swap(y1, y2);
    swap(x1, x2);
  }
  int lep = 0;
  for (int i = 0; i < n; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    if (jolmetsz(a, b, c, x1, y1, x2, y2) || jolmetsz(a, b, c, x2, y2, x1, y1))
      db++;
  }
  cout << db << endl;
}
