#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b, c, x1, y1, x2, y2;
  scanf("%lf%lf%lf%lf%lf%lf%lf", &a, &b, &c, &x1, &y1, &x2, &y2);
  double ans = abs(x1 - x2) + abs(y1 - y2);
  double Y1 = (-a * x1 - c) / b;
  double X1 = (-b * y1 - c) / a;
  double Y2 = (-a * x2 - c) / b;
  double X2 = (-b * y2 - c) / a;
  double res1 = sqrt((x1 - x2) * (x1 - x2) + (Y1 - Y2) * (Y1 - Y2)) +
                abs(Y1 - y1) + abs(Y2 - y2);
  double res2 = sqrt((x1 - X2) * (x1 - X2) + (Y1 - y2) * (Y1 - y2)) +
                abs(Y1 - y1) + abs(X2 - x2);
  double res3 = sqrt((X1 - X2) * (X1 - X2) + (y1 - y2) * (y1 - y2)) +
                abs(X1 - x1) + abs(X2 - x2);
  double res4 = sqrt((X1 - x2) * (X1 - x2) + (y1 - Y2) * (y1 - Y2)) +
                abs(X1 - x1) + abs(Y2 - y2);
  double res = min(min(res1, res2), min(res3, res4));
  ans = min(ans, res);
  printf("%.10lf", ans);
  return 0;
}
