#include <bits/stdc++.h>
using namespace std;
char getc() {
  char c = getchar();
  while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9'))
    c = getchar();
  return c;
}
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
long double ans, A, B, C, lx, ly, rx, ry;
long double dis_m(long double x, long double y, long double p, long double q) {
  return fabs(x - p) + fabs(y - q);
}
long double dis_o(long double x, long double y, long double p, long double q) {
  return sqrt((p - x) * (p - x) + (y - q) * (y - q));
}
struct data {
  long double x, y;
} a[2], b[2];
int main() {
  A = read(), B = read(), C = read();
  lx = read(), ly = read(), rx = read(), ry = read();
  ans = fabs(rx - lx) + fabs(ry - ly);
  if (A && B) {
    a[0].x = lx, a[0].y = (-C - A * lx) / B;
    a[1].y = ly, a[1].x = (-C - B * ly) / A;
    b[0].x = rx, b[0].y = (-C - A * rx) / B;
    b[1].y = ry, b[1].x = (-C - B * ry) / A;
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        ans = min(ans, dis_m(lx, ly, a[i].x, a[i].y) +
                           dis_o(a[i].x, a[i].y, b[j].x, b[j].y) +
                           dis_m(b[j].x, b[j].y, rx, ry));
  }
  printf("%.6Lf\n", ans);
  return 0;
}
