#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int x1, y1, x2, y2, n, x3, y3, x4, y4, temp;
  vector<pair<int, int> > v;
  map<pair<int, int>, int> m;
  vector<pair<int, pair<double, double> > > v2;
  cin >> x1 >> y1 >> x2 >> y2;
  bool e1 = 0, e2 = 0, e3 = 0, e4 = 0;
  if (x1 > x2 && y1 > y2) {
    e1 = 1;
    x3 = x1;
    y3 = y2;
    x4 = x2;
    y4 = y1;
  } else if (x1 > x2 && y1 < y2) {
    e2 = 1;
    x3 = x2;
    y3 = y1;
    x4 = x1;
    y4 = y2;
  } else if (x1 < x2 && y1 > y2) {
    e3 = 1;
    x3 = x2;
    y3 = y1;
    x4 = x1;
    y4 = y2;
  } else if (x1 < x2 && y1 < y2) {
    e4 = 1;
    x3 = x2;
    y3 = y1;
    x4 = x1;
    y4 = y2;
  }
  if (e3) {
    for (int i = x1; i <= x3; i++) {
      if (m[make_pair(i, y1)] == 0) {
        v.push_back(make_pair(i, y1));
        m[make_pair(i, y1)] = 1;
      }
    }
    for (int i = y2; i <= y3; i++) {
      if (m[make_pair(x3, i)] == 0) {
        v.push_back(make_pair(x3, i));
        m[make_pair(x3, i)] = 1;
      }
    }
    for (int i = x4; i <= x2; i++) {
      if (m[make_pair(i, y2)] == 0) {
        v.push_back(make_pair(i, y2));
        m[make_pair(i, y2)] = 1;
      }
    }
    for (int i = y4; i <= y1; i++) {
      if (m[make_pair(x4, i)] == 0) {
        v.push_back(make_pair(x4, i));
        m[make_pair(x4, i)] = 1;
      }
    }
  } else if (e1) {
    for (int i = y3; i <= y1; i++) {
      if (m[make_pair(x3, i)] == 0) {
        v.push_back(make_pair(x3, i));
        m[make_pair(x3, i)] = 1;
      }
    }
    for (int i = y2; i <= y1; i++) {
      if (m[make_pair(x2, i)] == 0) {
        v.push_back(make_pair(x2, i));
        m[make_pair(x2, i)] = 1;
      }
    }
    for (int i = x2; i <= x3; i++) {
      if (m[make_pair(i, y2)] == 0) {
        v.push_back(make_pair(i, y2));
        m[make_pair(i, y2)] = 1;
      }
    }
    for (int i = x2; i <= x1; i++) {
      if (m[make_pair(i, y1)] == 0) {
        v.push_back(make_pair(i, y1));
        m[make_pair(i, y1)] = 1;
      }
    }
  } else if (e2) {
    for (int i = x3; i <= x1; i++) {
      if (m[make_pair(i, y1)] == 0) {
        v.push_back(make_pair(i, y1));
        m[make_pair(i, y1)] = 1;
      }
    }
    for (int i = y3; i <= y2; i++) {
      if (m[make_pair(x3, i)] == 0) {
        v.push_back(make_pair(x3, i));
        m[make_pair(x3, i)] = 1;
      }
    }
    for (int i = x2; i <= x4; i++) {
      if (m[make_pair(i, y2)] == 0) {
        v.push_back(make_pair(i, y2));
        m[make_pair(i, y2)] = 1;
      }
    }
    for (int i = y1; i <= y4; i++) {
      if (m[make_pair(x4, i)] == 0) {
        v.push_back(make_pair(x4, i));
        m[make_pair(x4, i)] = 1;
      }
    }
  } else if (e4) {
    for (int i = x1; i <= x3; i++) {
      if (m[make_pair(i, y1)] == 0) {
        v.push_back(make_pair(i, y1));
        m[make_pair(i, y1)] = 1;
      }
    }
    for (int i = y3; i <= y2; i++) {
      if (m[make_pair(x3, i)] == 0) {
        v.push_back(make_pair(x3, i));
        m[make_pair(x3, i)] = 1;
      }
    }
    for (int i = x4; i <= x2; i++) {
      if (m[make_pair(i, y2)] == 0) {
        v.push_back(make_pair(i, y2));
        m[make_pair(i, y2)] = 1;
      }
    }
    for (int i = y1; i <= y4; i++) {
      if (m[make_pair(x4, i)] == 0) {
        v.push_back(make_pair(x4, i));
        m[make_pair(x4, i)] = 1;
      }
    }
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    double x, y, r;
    cin >> x >> y >> r;
    v2.push_back(make_pair(r, make_pair(x, y)));
  }
  int c = 0;
  for (int i = 0; i < v.size(); i++) {
    bool k = 0;
    for (int j = 0; j < v2.size(); j++) {
      double y = sqrt((v[i].first - v2[j].second.first) *
                          (v[i].first - v2[j].second.first) +
                      (v[i].second - v2[j].second.second) *
                          (v[i].second - v2[j].second.second));
      if (y <= v2[j].first) {
        k = 1;
        break;
      }
    }
    if (!k) {
      c++;
    }
  }
  cout << c << endl;
  return 0;
}
