#include <bits/stdc++.h>
using namespace std;
int height[128];
int main() {
  int w, h, u, d;
  cin >> w >> h;
  cin >> u >> d;
  height[d] = u;
  cin >> u >> d;
  height[d] = u;
  for (int i = h; i > 0; i--) {
    w += i;
    w -= height[i];
    if (w < 0) w = 0;
  }
  cout << w << endl;
  return 0;
}
