#include <bits/stdc++.h>
using namespace std;
int n;
int judge(int x, int y, int ra[1001][4]);
int main() {
  int ra[1001][4], x1, x2, y1, y2, temp;
  while (cin >> x1 >> y1 >> x2 >> y2) {
    temp = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= 3; j++) cin >> ra[i][j];
    }
    for (int i = min(x1, x2); i <= max(x1, x2); i++) {
      if (i == min(x1, x2) || i == max(x1, x2))
        for (int j = min(y1, y2); j <= max(y1, y2); j++) {
          if (judge(i, j, ra)) temp++;
        }
      else {
        if (judge(i, min(y1, y2), ra)) temp++;
        if (judge(i, max(y1, y2), ra)) temp++;
      }
    }
    cout << (max(x1, x2) - min(x1, x2)) * 2 + (max(y1, y2) - min(y1, y2)) * 2 -
                temp
         << endl;
  }
}
int judge(int x, int y, int ra[1001][4]) {
  double r;
  for (int i = 1; i <= n; i++) {
    r = sqrt(pow(x - ra[i][1], 2) + pow(y - ra[i][2], 2));
    if (r <= ra[i][3]) return 1;
  }
  return 0;
}
