#include <bits/stdc++.h>
using namespace std;
const int OO = (int)1e5;
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
struct dffaya {
  int x, y;
  double r;
};
bool dafyan(int x0, int y0, int x1, int y1, double r) {
  long long calc = (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1);
  return sqrt(calc) <= r;
}
int main() {
  fast();
  int x0, x1, x2, x3, y0, y1, y2, y3;
  cin >> x0 >> y0 >> x1 >> y1;
  x2 = x0, y2 = y1, x3 = x1, y3 = y0;
  vector<pair<int, int>> gen;
  gen.push_back({x0, y0}), gen.push_back({x1, y1}), gen.push_back({x2, y2}),
      gen.push_back({x3, y3});
  int n;
  cin >> n;
  vector<dffaya> v(n);
  for (int(i) = 0; (i) < (int)n; (i)++) cin >> v[i].x >> v[i].y >> v[i].r;
  sort(((gen).begin()), ((gen).end()));
  for (int i = min(gen[0].first, gen[2].first) + 1;
       i < max(gen[0].first, gen[2].first); i++) {
    pair<int, int> t;
    t.first = i, t.second = min(gen[0].second, gen[1].second), gen.push_back(t);
  }
  for (int i = min(gen[0].first, gen[2].first) + 1;
       i < max(gen[0].first, gen[2].first); i++) {
    pair<int, int> t;
    t.first = i, t.second = max(gen[0].second, gen[1].second), gen.push_back(t);
  }
  for (int i = min(gen[0].second, gen[1].second) + 1;
       i < max(gen[0].second, gen[1].second); i++) {
    pair<int, int> t;
    t.second = i, t.first = min(gen[0].first, gen[2].first), gen.push_back(t);
  }
  for (int i = min(gen[0].second, gen[1].second) + 1;
       i < max(gen[0].second, gen[1].second); i++) {
    pair<int, int> t;
    t.second = i, t.first = max(gen[0].first, gen[2].first), gen.push_back(t);
  }
  int ans = (gen[1].second - gen[0].second + 1) * 2 +
            (gen[2].first - gen[0].first + 1) * 2 - 4;
  for (auto i : gen)
    for (auto t : v)
      if (dafyan(i.first, i.second, t.x, t.y, t.r)) {
        ans--;
        break;
      }
  cout << ans;
}
