#include <bits/stdc++.h>
using namespace std;
long long x[2], y[2], dis[2];
long long a, b, c;
int n;
int main() {
  int ans = 0;
  for (int i = 0; i < 2; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld%lld", &a, &b, &c);
    for (int j = 0; j < 2; j++) {
      dis[j] = a * x[j] + b * y[j] + c;
      dis[j] /= llabs(dis[j]);
    }
    if (dis[0] != dis[1]) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
