#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y;
};
double distance(int x1, int y1, int x2, int y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  int x1, y1, x2, y2;
  scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
  vector<Point> persons;
  if (x1 > x2) {
    int temp = x1;
    x1 = x2;
    x2 = temp;
  }
  if (y1 > y2) {
    int temp = y1;
    y1 = y2;
    y2 = temp;
  }
  for (int i = x1; i <= x2; i++) {
    Point temp;
    temp.x = i;
    temp.y = y1;
    persons.push_back(temp);
    temp.y = y2;
    persons.push_back(temp);
  }
  for (int i = y1 + 1; i < y2; i++) {
    Point temp;
    temp.x = x1;
    temp.y = i;
    persons.push_back(temp);
    temp.x = x2;
    persons.push_back(temp);
  }
  int n, x, y, r;
  int size = persons.size();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d", &x, &y, &r);
    for (int j = 0; j < size; j++) {
      if (distance(x, y, persons[j].x, persons[j].y) <= r) {
        persons.erase(persons.begin() + j);
        size--;
        j--;
      }
    }
  }
  printf("%d\n", persons.size());
  return 0;
}
