#include <bits/stdc++.h>
using namespace std;
long long int w, h, u1, d1, u2, d2;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> w >> h >> u1 >> d1 >> u2 >> d2;
  while (h > 0) {
    w = w + h;
    if (h == d1) w = max(w - u1, (long long int)0);
    if (h == d2) w = max(w - u2, (long long int)0);
    h--;
  }
  cout << w << endl;
}
