#include <bits/stdc++.h>
using namespace std;
int main() {
  int xa, ya, xb, yb, n, count = 0;
  cin >> xa >> ya >> xb >> yb;
  if (xa > xb) {
    int t = xa;
    xa = xb;
    xb = t;
  }
  if (ya > yb) {
    int t = ya;
    ya = yb;
    yb = t;
  }
  cin >> n;
  int x[n], y[n], r[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> r[i];
  }
  for (int i = xa; i <= xb; i++) {
    for (int h = 0; h < n; h++) {
      double diff = sqrt((x[h] - i) * (x[h] - i) + (y[h] - ya) * (y[h] - ya));
      if (diff <= r[h]) {
        count++;
        break;
      }
    }
    for (int h = 0; h < n; h++) {
      double diff = sqrt((x[h] - i) * (x[h] - i) + (y[h] - yb) * (y[h] - yb));
      if (diff <= r[h]) {
        count++;
        break;
      }
    }
  }
  for (int j = (ya + 1); j < yb; j++) {
    for (int h = 0; h < n; h++) {
      double diff = sqrt((x[h] - xa) * (x[h] - xa) + (y[h] - j) * (y[h] - j));
      if (diff <= r[h]) {
        count++;
        break;
      }
    }
    for (int h = 0; h < n; h++) {
      double diff = sqrt((x[h] - xb) * (x[h] - xb) + (y[h] - j) * (y[h] - j));
      if (diff <= r[h]) {
        count++;
        break;
      }
    }
  }
  int ans = (2 * (xb - xa + yb - ya)) - count;
  cout << ans << "\n";
  return 0;
}
