#include <bits/stdc++.h>
using namespace std;
long long hx, hy, sx, sy, n;
long long a[305], b[305], c[305];
int main() {
  cin >> hx >> hy >> sx >> sy >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    c[i] = -c[i];
  }
  int cou = 0;
  for (int i = 0; i < n; i++) {
    if ((a[i] * hx + b[i] * hy > c[i] && a[i] * sx + b[i] * sy < c[i]) ||
        (a[i] * hx + b[i] * hy < c[i] && a[i] * sx + b[i] * sy > c[i]))
      cou++;
  }
  cout << cou << endl;
  return 0;
}
