#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 5;
const long long MOD = 1e9 + 7;
struct Line {
  double a, b, c;
};
int main() {
  pair<double, double> home, univ;
  cin >> home.first >> home.second;
  cin >> univ.first >> univ.second;
  int n;
  cin >> n;
  vector<Line> v(n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> v[i].a >> v[i].b >> v[i].c;
    if ((v[i].a * home.first + v[i].b * home.second + v[i].c) *
            (v[i].a * univ.first + v[i].b * univ.second + v[i].c) <
        0) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
