#include <bits/stdc++.h>
using namespace std;
long long abs(long long, long long);
double dis(long long x1, long long y1, long long x2, long long y2) {
  double d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  d = sqrt(d * 1.0);
  return d;
}
void solve() {
  long long w, h;
  cin >> w >> h;
  long long u1, d1, u2, d2;
  cin >> u1 >> d1 >> u2 >> d2;
  long long a = w;
  for (long long i = h; i > 0; i--) {
    a += i;
    if (i == d1) {
      a -= u1;
      if (a < 0) a = 0;
    }
    if (i == d2) {
      a -= u2;
      if (a < 0) a = 0;
    }
  }
  cout << a;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1;
  while (TESTS--) {
    solve();
  }
  return 0;
}
long long abs(long long a, long long b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
