#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int x0, y0, X, Y;
  int n;
  cin >> x0 >> y0 >> X >> Y;
  if (x0 > X) {
    int t = x0;
    x0 = X;
    X = t;
  }
  if (y0 > Y) {
    int t = y0;
    y0 = Y;
    Y = t;
  }
  X -= x0;
  Y -= y0;
  cin >> n;
  vector<int> Rx(n), Ry(n), Rr(n);
  for (int i = 0; i < n; i++) {
    cin >> Rx[i] >> Ry[i] >> Rr[i];
    Rx[i] -= x0;
    Ry[i] -= y0;
    Rr[i] *= Rr[i];
  }
  int ans = 0;
  for (int x = 0; x <= X; x++) {
    {
      bool OK = false;
      for (int i = 0; i < n; i++) {
        if ((Rx[i] - x) * (Rx[i] - x) + (Ry[i] - 0) * (Ry[i] - 0) <= Rr[i]) {
          OK = true;
          break;
        }
      }
      if (!OK) ++ans;
    };
    {
      bool OK = false;
      for (int i = 0; i < n; i++) {
        if ((Rx[i] - x) * (Rx[i] - x) + (Ry[i] - Y) * (Ry[i] - Y) <= Rr[i]) {
          OK = true;
          break;
        }
      }
      if (!OK) ++ans;
    };
  }
  for (int y = 1; y < Y; y++) {
    {
      bool OK = false;
      for (int i = 0; i < n; i++) {
        if ((Rx[i] - 0) * (Rx[i] - 0) + (Ry[i] - y) * (Ry[i] - y) <= Rr[i]) {
          OK = true;
          break;
        }
      }
      if (!OK) ++ans;
    };
    {
      bool OK = false;
      for (int i = 0; i < n; i++) {
        if ((Rx[i] - X) * (Rx[i] - X) + (Ry[i] - y) * (Ry[i] - y) <= Rr[i]) {
          OK = true;
          break;
        }
      }
      if (!OK) ++ans;
    };
  }
  cout << ans;
}
