#include <bits/stdc++.h>
using namespace std;
int main() {
  int ballWegiht, ballHegiht, RockWeight1, RockWeight2, Rockheight1,
      RockHeight2;
  cin >> ballWegiht;
  cin >> ballHegiht;
  cin >> RockWeight1;
  cin >> Rockheight1;
  cin >> RockWeight2;
  cin >> RockHeight2;
  if (Rockheight1 > RockHeight2) {
    int height = Rockheight1;
    Rockheight1 = RockHeight2;
    RockHeight2 = height;
    int weight = RockWeight1;
    RockWeight1 = RockWeight2;
    RockWeight2 = weight;
  }
  while (ballHegiht != 0) {
    ballWegiht += ballHegiht;
    if (ballHegiht == RockHeight2)
      ballWegiht -= RockWeight2;
    else if (ballHegiht == Rockheight1)
      ballWegiht -= RockWeight1;
    if (ballWegiht < 0) ballWegiht = 0;
    ballHegiht--;
  }
  cout << ballWegiht;
  return 0;
}
