#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int xa, ya, xb, yb, x, y, r;
  cin >> xa >> ya >> xb >> yb;
  int n;
  cin >> n;
  map<pair<int, int>, int> m;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> r;
    m[{x, y}] = r;
  }
  int cnt = (xa > xb ? (xa - xb) : xb - xa) + (ya > yb ? ya - yb : yb - ya);
  cnt = 2 * cnt;
  auto it = m.begin();
  if (xa > xb) swap(xa, xb);
  if (ya > yb) swap(ya, yb);
  for (int xr = xa; xr <= xb; xr++) {
    for (it = m.begin(); it != m.end(); it++) {
      if (pow(xr - (it->first).first, 2) + pow(ya - (it->first).second, 2) <=
          pow(it->second, 2)) {
        cnt--;
        break;
      }
    }
  }
  for (int xr = xa; xr <= xb; xr++) {
    for (it = m.begin(); it != m.end(); it++) {
      if (pow(xr - (it->first).first, 2) + pow(yb - (it->first).second, 2) <=
          pow(it->second, 2)) {
        cnt--;
        break;
      }
    }
  }
  int y2 = ya;
  for (int yr = ya + 1; yr < yb; yr++) {
    for (it = m.begin(); it != m.end(); it++) {
      if (pow(xa - (it->first).first, 2) + pow(yr - (it->first).second, 2) <=
          pow(it->second, 2)) {
        cnt--;
        break;
      }
    }
  }
  for (int yr = ya + 1; yr < yb; yr++) {
    for (it = m.begin(); it != m.end(); it++) {
      if (pow(xb - (it->first).first, 2) + pow(yr - (it->first).second, 2) <=
          pow(it->second, 2)) {
        cnt--;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
