#include <bits/stdc++.h>
using namespace std;
double xa, ya, xb, yb, x[10001], y[10001], s, t[10001], l, r;
int ans, i, j, n;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> xa >> ya >> xb >> yb;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> x[i] >> y[i] >> t[i];
  for (i = min(xa, xb); i <= max(xa, xb); i++) {
    l = i;
    r = ya;
    ans++;
    for (j = 1; j <= n; j++) {
      s = sqrt((x[j] - l) * (x[j] - l) + (y[j] - r) * (y[j] - r));
      if (s <= t[j]) {
        ans--;
        j = n + 1;
      }
    }
    l = i;
    r = yb;
    ans++;
    for (j = 1; j <= n; j++) {
      s = sqrt((x[j] - l) * (x[j] - l) + (y[j] - r) * (y[j] - r));
      if (s <= t[j]) {
        ans--;
        j = n + 1;
      }
    }
  }
  for (i = min(ya, yb) + 1; i <= max(ya, yb) - 1; i++) {
    l = xa;
    r = i;
    ans++;
    for (j = 1; j <= n; j++) {
      s = sqrt((x[j] - l) * (x[j] - l) + (y[j] - r) * (y[j] - r));
      if (s <= t[j]) {
        ans--;
        j = n + 1;
      }
    }
    l = xb;
    r = i;
    ans++;
    for (j = 1; j <= n; j++) {
      s = sqrt((x[j] - l) * (x[j] - l) + (y[j] - r) * (y[j] - r));
      if (s <= t[j]) {
        ans--;
        j = n + 1;
      }
    }
  }
  cout << ans;
}
