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