#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
long double a, b, c, x, y, xx, yy;
inline long double gety(long double x) { return (-a * x - c) / b; }
inline long double getx(long double y) { return (-b * y - c) / a; }
inline long double dist(long double x, long double y, long double xx,
                        long double yy) {
  return sqrt((x - xx) * (x - xx) + (y - yy) * (y - yy));
}
signed main() {
  a = read(), b = read(), c = read();
  x = read(), y = read(), xx = read(), yy = read();
  long double res = abs(x - xx) + abs(y - yy);
  if (a == 0 || b == 0) {
    printf("%.6lf\n", (double)res);
    return 0;
  }
  long double yofx = gety(x), yofxx = gety(xx);
  res = min(res, dist(x, yofx, xx, yofxx) + abs(y - yofx) + abs(yy - yofxx));
  long double xofy = getx(y), xofyy = getx(yy);
  res = min(res, dist(xofy, y, xofyy, yy) + abs(x - xofy) + abs(xx - xofyy));
  res = min(res, dist(xofy, y, xx, yofxx) + abs(x - xofy) + abs(yy - yofxx));
  res = min(res, dist(x, yofx, xofyy, yy) + abs(y - yofx) + abs(xx - xofyy));
  printf("%.10lf\n", (double)res);
  return 0;
}
