#include <bits/stdc++.h>
using namespace std;
int main() {
  int w, d, u1, h1, u2, h2;
  cin >> w >> d >> u1 >> h1 >> u2 >> h2;
  for (int i = d; i > 0; i--) {
    w = w + i;
    if (i == h1) {
      w = w - u1;
    }
    if (i == h2) {
      w = w - u2;
    }
    if (w < 0) w = 0;
  }
  cout << w << endl;
}
