#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const double eps = 1e-8;
const double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch;
  ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch & 15);
    ch = getchar();
  }
  if (f)
    return x;
  else
    return -x;
}
struct point {
  double x, y;
} A, B, a[2], b[2];
double fabs(double a) {
  if (a < 0.0) return -a;
  return a;
}
double get_dis(const point &a, const point &b) {
  if (fabs(a.x - b.x) <= eps) return abs(a.y - b.y);
  if (fabs(a.y - b.y) <= eps) return abs(a.x - b.x);
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
struct line {
  double a, b, c;
  double get_x(int y) { return (-c - b * y) / a; }
  double get_y(int x) { return (-c - a * x) / b; }
} l;
int main() {
  l.a = (double)read();
  l.b = (double)read();
  l.c = (double)read();
  A.x = (double)read();
  A.y = (double)read();
  B.x = (double)read();
  B.y = (double)read();
  double ans = fabs(A.x - B.x) + fabs(A.y - B.y);
  a[0].y = A.y;
  a[0].x = l.get_x(a[0].y);
  a[1].x = A.x;
  a[1].y = l.get_y(a[1].x);
  b[0].y = B.y;
  b[0].x = l.get_x(b[0].y);
  b[1].x = B.x;
  b[1].y = l.get_y(b[1].x);
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j <= 1; j++) {
      ans = min(ans, get_dis(A, a[i]) + get_dis(B, b[j]) + get_dis(a[i], b[j]));
    }
  printf("%.12lf\n", ans);
  return 0;
}
