#include <bits/stdc++.h>
using namespace std;
void solve() {
  int w, h, u1, d1, u2, d2;
  cin >> w >> h >> u1 >> d1 >> u2 >> d2;
  for (int i = h; i >= 1; i--) {
    w += i;
    if (d1 == i) w -= u1;
    if (d2 == i) w -= u2;
    if (w < 0) w = 0;
  }
  cout << w << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(11);
  clock_t beg = clock();
  int t = 1;
  while (t--) solve();
  clock_t end = clock();
  fprintf(stderr, "%lf sec\n", (double)(end - beg) / (CLOCKS_PER_SEC));
  return 0;
}
