#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, MOD = 1e9 + 7;
int x, xx, y, yy, i, j, a, b, c, n, ans;
map<pair<int, int>, int> d;
vector<pair<int, int> > v;
int main() {
  cin >> x >> y >> xx >> yy;
  cin >> n;
  for (i = min(x, xx); i <= max(x, xx); i++)
    for (j = min(y, yy); j <= max(y, yy); j++)
      if (i == x || i == xx || j == y || j == yy) {
        if (i >= min(x, xx) && i <= max(x, xx) && j >= min(y, yy) &&
            j <= max(y, yy))
          v.push_back({i, j});
      }
  while (n--) {
    cin >> a >> b >> c;
    for (auto x : v)
      if (sqrt((a - x.first) * (a - x.first) +
               (b - x.second) * (b - x.second)) <= c)
        d[{x.first, x.second}] = 1;
  }
  for (auto x : v)
    if (d[{x.first, x.second}] == 0) ans++;
  cout << ans;
  return 0;
}
