#include <bits/stdc++.h>
using namespace std;
int n, k, m;
int X1, X2, Y1, Y2;
struct ac {
  int a, b, c;
};
void input() {
  int i, ans = 0;
  long long a, b, c;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld %lld %lld", &a, &b, &c);
    long long x = (long long)a * X1 + (long long)b * Y1 + (long long)c;
    long long y = (long long)a * X2 + (long long)b * Y2 + (long long)c;
    if (x > 0 && y < 0 || x < 0 && y > 0) {
      ans++;
    }
  }
  printf("%d\n", ans);
}
void solve() {}
int main() {
  while (scanf("%d %d %d %d", &X1, &Y1, &X2, &Y2) != EOF) {
    input();
    solve();
  }
  return 0;
}
