#include <bits/stdc++.h>
int main() {
  double a, b, c;
  scanf("%lf %lf %lf", &a, &b, &c);
  double x1, y1, x2, y2;
  scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
  double ans = abs(x1 - x2) + abs(y1 - y2), ans1;
  if (!(a == 0 || b == 0)) {
    double xa = -(b * y1 + c) / a;
    double xb = -(b * y2 + c) / a;
    double ya = -(a * x1 + c) / b;
    double yb = -(a * x2 + c) / b;
    double d = abs(x1 - xa);
    double d2 = abs(y2 - yb);
    ans1 = d + d2 + sqrt((xa - x2) * (xa - x2) + (y1 - yb) * (y1 - yb));
    if (ans1 < ans) {
      ans = ans1;
    }
    d = abs(x1 - xa);
    d2 = abs(x2 - xb);
    ans1 = d + d2 + sqrt((xa - xb) * (xa - xb) + (y2 - y1) * (y2 - y1));
    if (ans1 < ans) {
      ans = ans1;
    }
    d = abs(y1 - ya);
    d2 = abs(y2 - yb);
    ans1 = d + d2 + sqrt((ya - yb) * (ya - yb) + (x2 - x1) * (x2 - x1));
    if (ans1 < ans) {
      ans = ans1;
    }
    d = abs(y1 - ya);
    d2 = abs(x2 - xb);
    ans1 = d + d2 + sqrt((ya - y2) * (ya - y2) + (xb - x1) * (xb - x1));
    if (ans1 < ans) {
      ans = ans1;
    }
  }
  printf("%.14f\n", ans);
  return 0;
}
