#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = (int)1e9;
int main() {
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int x, y, r;
  int n;
  cin >> n;
  if (x1 > x2 && y1 < y2) {
    swap(x1, x2);
    swap(y1, y2);
  }
  if (x1 < x2 && y1 < y2) {
    swap(x1, x2);
    swap(y1, y2);
  }
  int a, b;
  if (x1 > x2 && y1 > y2) {
    a = x1;
    b = y1;
    x1 = x2;
    x2 = a;
  }
  int res = 0;
  bool t[2005][2005];
  for (int c = 0; c < 2005; ++c)
    for (int v = 0; v < 2005; ++v) t[c][v] = false;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y >> r;
    for (double j = x1; j <= x2; ++j) {
      if (sqrt((x - j) * (x - j) + (y - y1) * (y - y1)) <= r) {
        if (t[(int)(j + 1001)][(int)(y1 + 1001)] == false) ++res;
        t[(int)j + 1001][(int)y1 + 1001] = true;
      }
      if (sqrt((x - j) * (x - j) + (y - y2) * (y - y2)) <= r) {
        if (t[(int)j + 1001][(int)y2 + 1001] == false) ++res;
        t[(int)j + 1001][(int)y2 + 1001] = true;
      }
    }
    for (double j = y2; j <= y1; ++j) {
      if (sqrt((x - x1) * (x - x1) + (y - j) * (y - j)) <= r) {
        if (t[(int)x1 + 1001][(int)j + 1001] == false) ++res;
        t[(int)x1 + 1001][(int)j + 1001] = true;
      }
      if (sqrt((x - x2) * (x - x2) + (y - j) * (y - j)) <= r) {
        if (t[(int)x2 + 1001][(int)j + 1001] == false) ++res;
        t[(int)x2 + 1001][(int)j + 1001] = true;
      }
    }
  }
  int z = 2 * (abs(x2 - x1) + abs(y2 - y1));
  z -= res;
  cout << z;
  return 0;
}
