#include <bits/stdc++.h>
const double PI = 3.141592653589793238460;
using namespace std;
void superDuper() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  if (x1 > x2) swap(x1, x2);
  if (y2 > y1) swap(y1, y2);
  double tx = x2, ty = y2;
  vector<std::complex<double>> allPoints;
  while (ty < y1) allPoints.push_back({tx, ty++});
  while (tx > x1) allPoints.push_back({tx--, ty});
  while (ty > y2) allPoints.push_back({tx, ty--});
  while (tx < x2) allPoints.push_back({tx++, ty});
  long long int count = 0;
  int n;
  cin >> n;
  std::complex<double> limiter = {INT_MIN, INT_MIN};
  set<tuple<double, double, int>> st;
  while (n--) {
    double x, y;
    cin >> x >> y;
    std::complex<double> cc = {x, y};
    int dist;
    cin >> dist;
    tuple<double, double, int> ct = {x, y, dist};
    if (st.find(ct) != st.end())
      continue;
    else
      st.insert(ct);
    for (int i = 0; i < allPoints.size(); i++) {
      if (allPoints[i] == limiter) continue;
      if (abs(allPoints[i] - cc) <= dist) allPoints[i] = limiter;
    }
  }
  for (int i = 0; i < allPoints.size(); i++)
    if (allPoints[i] != limiter) count++;
  cout << count << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  superDuper();
}
