#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> se;
void set_val(int a, int b, int c, bool f) {
  if (f == 1)
    for (int i = b; i <= c; ++i) se.insert(make_pair(a, i));
  else
    for (int i = b; i <= c; ++i) se.insert(make_pair(i, a));
}
int x1, x2, y2, n, xi, yi, ymx, ymn, xmx, xmn, siz, c;
int y;
int r;
double len(int a, int b, int c, int d) {
  return sqrt(pow((a - c), 2) + pow((b - d), 2));
}
int main() {
  cin >> x1;
  cin >> y;
  cin >> x2;
  cin >> y2;
  cin >> n;
  ymn = min(y, y2);
  ymx = max(y, y2);
  xmn = min(x1, x2);
  xmx = max(x1, x2);
  set_val(x1, ymn, ymx, true);
  set_val(x2, ymn, ymx, true);
  set_val(y, xmn, xmx, false);
  set_val(y2, xmn, xmx, false);
  vector<pair<int, int>> v(se.begin(), se.end());
  siz = v.size();
  while (n--) {
    cin >> xi >> yi >> r;
    for (int i = 0; i < (int)v.size(); i++) {
      if (v[i].first == 100000) continue;
      if (len(v[i].first, v[i].second, xi, yi) <= r) {
        v[i].first = 100000;
      }
    }
  }
  for (int i = 0; i < (int)v.size(); i++) {
    if (v[i].first != 100000) c++;
  }
  cout << c << endl;
  return 0;
}
