#include <bits/stdc++.h>
using namespace std;
typedef struct node {
  int x, y;
} P;
P local[10010];
void swapp(int *a, int *b) {
  int *c;
  c = a;
  a = b;
  b = c;
}
int getnode(int xa, int ya, int xb, int yb) {
  int cur = 0;
  if (ya > yb) {
    int c = ya;
    ya = yb;
    yb = c;
  }
  if (xa > xb) {
    int c = xa;
    xa = xb;
    xb = c;
  }
  for (int k = ya; k <= yb; k++) {
    local[cur].x = xa;
    local[cur++].y = k;
    local[cur].x = xb;
    local[cur++].y = k;
  }
  for (int k = xa + 1; k < xb; k++) {
    local[cur].x = k;
    local[cur++].y = ya;
    local[cur].x = k;
    local[cur++].y = yb;
  }
  return cur;
}
int main() {
  int xa, xb, ya, yb;
  int n;
  int x[1010], y[1010], r[1010];
  while (scanf("%d%d%d%d", &xa, &xb, &ya, &yb) == 4) {
    cin >> n;
    for (int i = 0; i < n; i++) {
      scanf("%d%d%d", &x[i], &y[i], &r[i]);
    }
    int sum = getnode(xa, xb, ya, yb);
    int ans = 0;
    for (int i = 0; i < sum; i++) {
      int get = 0;
      for (int j = 0; j < n; j++) {
        if (((x[j] - local[i].x) * (x[j] - local[i].x) +
             (y[j] - local[i].y) * (y[j] - local[i].y)) <= r[j] * r[j]) {
          get = 1;
          break;
        }
      }
      if (!get) ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
