#include <bits/stdc++.h>
using namespace std;
int main() {
  int w, h, w1, h1, w2, h2;
  cin >> w >> h >> w1 >> h1 >> w2 >> h2;
  if (h1 < h2) {
    int tmpw = w2, tmph = h2;
    w2 = w1;
    h2 = h1;
    w1 = tmpw;
    h1 = tmph;
  }
  int final_w = w;
  for (int i = h; i >= 0; i--) {
    final_w += i;
    if (i == h1) {
      final_w -= w1;
      if (final_w < 0) final_w = 0;
    }
    if (i == h2) {
      final_w -= w2;
      if (final_w < 0) final_w = 0;
    }
  }
  cout << final_w << endl;
  return 0;
}
