#include <bits/stdc++.h>
using namespace std;
void Arr2DInit(vector<vector<int> > &a, int n, int m) {
  a.resize(n);
  for (int i = 0; i < n; i++) a[i].resize(m);
}
template <class T>
T minn(T a, T b) {
  return a < b ? a : b;
}
template <class T>
T maxx(T a, T b) {
  return a > b ? a : b;
}
long long Pow(long long a, long long n) {
  if (n == 0) return 1;
  if (n == 1) return a;
  if (n % 2 == 0)
    return Pow(a, n / 2) * Pow(a, n / 2);
  else
    return Pow(a, n / 2) * Pow(a, n / 2) * a;
}
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
string direct = "UDRL";
struct SAVE {
  int a, b, i;
};
bool Cmp(SAVE a, SAVE b) { return abs(a.a - a.b) > abs(b.a - b.b); }
int main() {
  int w, h, w1, w2, h1, h2;
  cin >> w >> h >> w1 >> h1 >> w2 >> h2;
  for (int i = h; i >= 0; i--) {
    w += i;
    w -= (h1 == i ? w1 : 0);
    w -= (h2 == i ? w2 : 0);
    w = maxx(0, w);
  }
  cout << w;
}
