#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
set<pair<int, int>> v;
int main() {
  fast();
  int x1, y1, x2, y2;
  int c = 0;
  cin >> x1 >> y1 >> x2 >> y2;
  if (x2 < x1) swap(x1, x2);
  if (y2 < y1) swap(y2, y1);
  for (int i = x1; i <= x2; i++) {
    v.insert(make_pair(i, y1));
    v.insert(make_pair(i, y2));
  }
  for (int i = y1; i <= y2; i++) {
    v.insert(make_pair(x1, i));
    v.insert(make_pair(x2, i));
  }
  int n;
  cin >> n;
  set<pair<int, int>>::iterator itr;
  vector<pair<int, int>> v2(n);
  pair<int, int> v4;
  vector<int> v3(n);
  for (int i = 0; i < n; i++) {
    cin >> v2[i].first >> v2[i].second >> v3[i];
  }
  for (itr = v.begin(); itr != v.end(); itr++) {
    int b = 0;
    for (int j = 0; j < n; j++) {
      v4 = *itr;
      double dis = sqrt(pow((v4.first - v2[j].first), 2) +
                        pow((v4.second - v2[j].second), 2));
      if (dis <= v3[j]) {
        b = 1;
        break;
      }
    }
    if (b == 0) c++;
  }
  cout << c;
  return 0;
}
