public void solve() throws IOException {
    long xHome = nextLong();
    long yHome = nextLong();
    long xUni = nextLong();
    long yUni = nextLong();
    
    int n = nextInt();
    int count = 0;
    for (int x = 0; x < n; x++) {
      long a = nextLong();
      long b = nextLong();
      long c = nextLong();
      Long home = xHome * a + yHome * b + c;
      Long uni = xUni * a + yUni * b + c;
      if (home > 0 && uni < 0 || home < 0 && uni > 0) {
        count++;
      }
    }
    System.out.println(count);
  }