#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
long long int power(long long int base, long long int exp) {
  long long int res = 1;
  while (exp) {
    if (exp % 2) res *= base;
    base *= base;
    res %= mod;
    base %= mod;
    exp /= 2;
  }
  return res;
}
long long int x[2], y[2], val[2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, n, a, b, c;
  for (long long int j = 0; j < 2; j++) cin >> x[j] >> y[j];
  cin >> n;
  long long int ans = 0;
  for (i = 1; i <= n; i++) {
    cin >> a >> b >> c;
    for (long long int j = 0; j < 2; j++) {
      val[j] = -1;
      if (a * x[j] + b * y[j] + c > 0) val[j] = 1;
    }
    if (val[1] > 0 && val[0] < 0) ans++;
    if (val[1] < 0 && val[0] > 0) ans++;
  }
  cout << ans;
  return 0;
}
