#include <bits/stdc++.h>
using namespace std;
float phytag(pair<float, float> a, pair<float, float> b) {
  return sqrt(pow(a.first - b.first, 2) + pow(a.second - b.second, 2));
}
int main() {
  float a, b, c;
  pair<float, float> p[2];
  pair<float, float> px[2], py[2];
  cin >> a >> b >> c;
  cin >> p[0].first >> p[0].second >> p[1].first >> p[1].second;
  for (int i = 0; i < 2; i++) {
    px[i].first = p[i].first;
    px[i].second = (a * p[i].first + c) / (float)-b;
    py[i].second = p[i].second;
    py[i].first = (b * p[i].second + c) / (float)-a;
  }
  float minDist =
      (float)(abs(p[0].first - p[1].first) + abs(p[0].second - p[1].second));
  printf(
      "%.10f\n",
      fmin(
          minDist,
          fmin(
              fmin(fabs(p[0].second - px[0].second) +
                       fabs(p[1].second - px[1].second) + phytag(px[0], px[1]),
                   fabs(p[0].first - py[0].first) +
                       fabs(p[1].second - px[1].second) + phytag(py[0], px[1])),
              fmin(fabs(p[0].second - px[0].second) +
                       fabs(p[1].first - py[1].first) + phytag(px[0], py[1]),
                   fabs(p[0].first - py[0].first) +
                       fabs(p[1].first - py[1].first) +
                       phytag(py[0], py[1])))));
  return 0;
}
