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