#include <bits/stdc++.h>
using namespace std;
const int INF = 2123456789;
int a, b, c;
int n, m, k;
int x, y;
int r;
set<pair<int, int> > S;
int x1, x2, z1, z2;
string s;
int main() {
  cin >> x1 >> z1 >> x2 >> z2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> r;
    for (int xx = min(x1, x2); xx <= max(x1, x2); xx++) {
      if ((xx - x) * (xx - x) + (y - z1) * (y - z1) <= r * r)
        S.insert(make_pair(xx, z1));
      if ((xx - x) * (xx - x) + (y - z2) * (y - z2) <= r * r)
        S.insert(make_pair(xx, z2));
    }
    for (int yy = min(z1, z2); yy <= max(z1, z2); yy++) {
      if ((yy - y) * (yy - y) + (x - x1) * (x - x1) <= r * r)
        S.insert(make_pair(x1, yy));
      if ((yy - y) * (yy - y) + (x - x2) * (x - x2) <= r * r)
        S.insert(make_pair(x2, yy));
    }
  }
  int table = (max(x1, x2) - min(x1, x2)) * 2 + (max(z1, z2) - min(z1, z2)) * 2;
  cout << table - S.size() << endl;
  return 0;
}
