#include <bits/stdc++.h>
using namespace std;
const int d4x[4] = {1, 0, -1, 0}, d4y[4] = {0, 1, 0, -1};
const int d8x[8] = {1, 1, 0, -1, -1, -1, 0, 1},
          d8y[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int xa, ya, xb, yb;
  cin >> xa >> ya >> xb >> yb;
  int xMin = min(xa, xb);
  int xMax = max(xa, xb);
  int yMin = min(ya, yb);
  int yMax = max(ya, yb);
  int n;
  cin >> n;
  set<pair<int, int> > generalsWithHeating;
  for (int j = 0; j < n; j++) {
    int x, y, r;
    cin >> x >> y >> r;
    for (int i = xMin; i <= xMax; i++) {
      if ((i - x) * (i - x) + (yMin - y) * (yMin - y) <= r * r) {
        generalsWithHeating.insert({i, yMin});
      }
    }
    for (int i = xMin; i <= xMax; i++) {
      if ((i - x) * (i - x) + (yMax - y) * (yMax - y) <= r * r) {
        generalsWithHeating.insert({i, yMax});
      }
    }
    for (int i = yMin; i <= yMax; i++) {
      if ((x - xMin) * (x - xMin) + (i - y) * (i - y) <= r * r) {
        generalsWithHeating.insert({xMin, i});
      }
    }
    for (int i = yMin; i <= yMax; i++) {
      if ((x - xMax) * (x - xMax) + (i - y) * (i - y) <= r * r) {
        generalsWithHeating.insert({xMax, i});
      }
    }
  }
  cout << 2 * (yMax - yMin) + 2 * (xMax - xMin) - generalsWithHeating.size()
       << "\n";
  return 0;
}
