#include <bits/stdc++.h>   using namespace std;   const double pi = 4 * atan(1);   int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }   int lcm(int a, int b) { return a / gcd(a, b) * b; }   const int LEN = 330;   int main() {     long long x1, y1, x2, y2;     long long n;     long long arr[LEN][3];     long long x, y;     cin >> x1 >> y1;     cin >> x2 >> y2;     cin >> n;     int ans = 0;     for (int i = 0; i < n; i++) cin >> arr[i][0] >> arr[i][1] >> arr[i][2];     for (int i = 0; i < n; i++) {       x = arr[i][0] * x1 + arr[i][1] * y1 + arr[i][2];       y = arr[i][0] * x2 + arr[i][1] * y2 + arr[i][2];       if (x > 0 && y < 0 || x < 0 && y > 0) ans++;     }     cout << ans << endl;     return 0;   }   