#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long INF = 4 * (long long)1e18 + 7;
const long double eps = 1e-9;
bool ls(long double a, long double b) { return a < b - eps; }
bool lseq(long double a, long double b) { return a < b + eps; }
bool eq(long double a, long double b) { return a < b + eps && a > b - eps; }
struct Point {
  long double x;
  long double y;
  Point() {}
  Point(long double x, long double y) : x(x), y(y) {}
};
struct Vector {
  long double x;
  long double y;
  Vector() {}
  Vector(long double x, long double y) : x(x), y(y) {}
  Vector(Point a, Point b) : x(b.x - a.x), y(b.y - a.y) {}
  long long operator*(Vector b) { return x * b.x + y * b.y; }
  long long operator%(Vector b) { return x * b.y - b.x * y; }
  long long len2() { return x * x + y * y; }
  long double len() { return sqrt(x * x + y * y); }
};
signed main() {
  if (false) {
    freopen("output.txt", "w", stdout);
    freopen("input.txt", "r", stdin);
  }
  ios_base::sync_with_stdio(false);
  long double a, b, c;
  cin >> a >> b >> c;
  Point s, f;
  cin >> s.x >> s.y >> f.x >> f.y;
  long double u = max(s.y, f.y);
  long double r = max(s.x, f.x);
  long double l = min(s.x, f.x);
  long double d = min(s.y, f.y);
  long double len = abs(s.x - f.x) + abs(s.y - f.y);
  if (a != 0 && b != 0) {
    Point ss = s;
    Point ff = f;
    bool ok = false;
    long double y = (-a * ss.x - c) / b;
    if (lseq(d, y) && lseq(y, u)) {
      ok = true;
      ss.y = y;
    }
    if (!ok) {
      long double x = (-b * ss.y - c) / a;
      if (lseq(l, x) && lseq(x, r)) {
        ok = true;
        ss.x = x;
      }
    }
    if (!ok)
      goto ans;
    else
      ok = false;
    y = (-a * ff.x - c) / b;
    if (lseq(d, y) && lseq(y, u)) {
      ok = true;
      ff.y = y;
    }
    if (!ok) {
      long double x = (-b * ff.y - c) / a;
      if (lseq(l, x) && lseq(x, r)) {
        ok = true;
        ff.x = x;
      }
    }
    if (ok) {
      long double cutlen =
          Vector(s, ss).len() + Vector(ss, ff).len() + Vector(ff, f).len();
      len = min(len, cutlen);
    }
  }
ans:
  cout.precision(9);
  cout << fixed << len << endl;
  return 0;
}
