#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (b == d && c == e) {
    cout << 0;
  } else if (b == d && c != e) {
    int cc = fabs(c - e);
    if (cc % (a + a) == 0) {
      cout << fabs(c - e) / (a + a);
    } else {
      cout << floor(fabs(c - e) / (a + a)) + 1;
    }
  } else if (b != d && c == e) {
    int ccc = fabs(b - d);
    if (ccc % (a + a) == 0) {
      cout << fabs(b - d) / (a + a);
    } else {
      cout << floor(fabs(b - d) / (a + a)) + 1;
    }
  } else {
    float ff = atan(abs(fabs(e - c) / fabs(d - b)));
    float bb = abs(cos(ff)) + abs(b);
    float cc = abs(sin(ff)) + abs(c);
    float rr1 = abs((abs(d) - bb) / a);
    float rr2 = abs((abs(e) - cc) / a);
    cout << floor(max(rr1, rr2)) + 1;
  }
  return 0;
}
