#include <bits/stdc++.h>
using namespace std;
int x[1005], y[1005], r[1005];
int main() {
  int gnrs, c1 = 1, c2 = 1, c3 = 1, c4 = 1, gnr, x1, x2, y1, y2, n, i, j, k,
            minx, miny, maxx, maxy, xx, yy;
  cin >> x1 >> y1 >> x2 >> y2 >> n;
  for (i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i];
  minx = min(x1, x2);
  maxx = max(x1, x2);
  miny = min(y1, y2);
  maxy = max(y1, y2);
  gnrs = gnr = (maxx - minx + maxy - miny) * 2;
  xx = minx;
  yy = miny;
  while (gnr--) {
    for (i = 0; i < n; i++) {
      if (sqrt(((xx) - (x[i])) * ((xx) - (x[i])) +
               ((yy) - (y[i])) * ((yy) - (y[i]))) <= r[i]) {
        gnrs--;
        break;
      }
    }
    if (c1 and xx < maxx) {
      xx++;
    } else if (c2 and yy < maxy) {
      yy++;
      c1 = 0;
    } else if (c3 and xx > minx) {
      xx--;
      c2 = 0;
    } else if (c4 and yy > miny) {
      yy--;
      c3 = 0;
    }
  }
  cout << gnrs << endl;
  return 0;
}
