#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[1003][3], i, j, k = 0, x1, y1, x2, y2, x;
  bool b = false;
  cin >> x1 >> y1 >> x2 >> y2 >> n;
  for (i = 1; i <= n; i++) cin >> a[i][1] >> a[i][2] >> a[i][3];
  if (x2 > x1) {
    x = x1;
    x1 = x2;
    x2 = x;
  }
  if (y2 > y1) {
    x = y1;
    y1 = y2;
    y2 = x;
  }
  x = 0;
  if ((x1 - x2) > 1)
    for (i = x2; i <= x1; i++) {
      for (j = 1; j <= n; j++)
        if (sqrt(pow(double(i - a[j][1]), 2) + pow(double(y1 - a[j][2]), 2)) <=
            a[j][3]) {
          k--;
          break;
        }
      k++;
      for (j = 1; j <= n; j++)
        if (sqrt(pow(double(i - a[j][1]), 2) + pow(double(y2 - a[j][2]), 2)) <=
            a[j][3]) {
          k--;
          break;
        }
      k++;
    }
  else
    b = true;
  if ((y1 - y2) > 1)
    for (i = (y2 + 1); i <= (y1 - 1); i++) {
      for (j = 1; j <= n; j++)
        if (sqrt(pow(double(x1 - a[j][1]), 2) + pow(double(i - a[j][2]), 2)) <=
            a[j][3]) {
          k--;
          break;
        }
      k++;
      for (j = 1; j <= n; j++)
        if (sqrt(pow(double(x2 - a[j][1]), 2) + pow(double(i - a[j][2]), 2)) <=
            a[j][3]) {
          k--;
          break;
        }
      k++;
    }
  else if (b == true) {
    for (j = 1; j <= n; j++)
      if (sqrt(pow(double(x1 - a[j][1]), 2) + pow(double(y1 - a[j][2]), 2)) <=
          a[j][3]) {
        k--;
        break;
      }
    k++;
    for (j = 1; j <= n; j++)
      if (sqrt(pow(double(x2 - a[j][1]), 2) + pow(double(y1 - a[j][2]), 2)) <=
          a[j][3]) {
        k--;
        break;
      }
    k++;
    for (j = 1; j <= n; j++)
      if (sqrt(pow(double(x1 - a[j][1]), 2) + pow(double(y2 - a[j][2]), 2)) <=
          a[j][3]) {
        k--;
        break;
      }
    k++;
    for (j = 1; j <= n; j++)
      if (sqrt(pow(double(x2 - a[j][1]), 2) + pow(double(y2 - a[j][2]), 2)) <=
          a[j][3]) {
        k--;
        break;
      }
    k++;
  }
  cout << k;
  return 0;
}
