#include <bits/stdc++.h>
using namespace std;
int xa, ya, xb, yb, x[1010], y[1010], r[1010], resp, n;
int main() {
  scanf("%d %d %d %d", &xa, &ya, &xb, &yb);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d %d", &x[i], &y[i], &r[i]);
  if (xa > xb) swap(xa, xb);
  if (ya > yb) swap(ya, yb);
  for (int i = xa; i <= xb; i++) {
    for (int j = 0; j < n; j++) {
      if ((x[j] - i) * (x[j] - i) + (y[j] - ya) * (y[j] - ya) <= r[j] * r[j]) {
        resp++;
        break;
      }
    }
    for (int j = 0; j < n; j++) {
      if ((x[j] - i) * (x[j] - i) + (y[j] - yb) * (y[j] - yb) <= r[j] * r[j]) {
        resp++;
        break;
      }
    }
  }
  for (int i = ya + 1; i < yb; i++) {
    for (int j = 0; j < n; j++) {
      if ((x[j] - xa) * (x[j] - xa) + (y[j] - i) * (y[j] - i) <= r[j] * r[j]) {
        resp++;
        break;
      }
    }
    for (int j = 0; j < n; j++) {
      if ((x[j] - xb) * (x[j] - xb) + (y[j] - i) * (y[j] - i) <= r[j] * r[j]) {
        resp++;
        break;
      }
    }
  }
  printf("%d\n", 2 * (xb - xa) + 2 * (yb - ya) - resp);
  return 0;
}
