#include <bits/stdc++.h>
double min(double a, double b) { return a > b ? b : a; }
double diss(double x1, double y1, double x2, double y2) {
  x1 -= x2;
  y1 -= y2;
  return sqrt(x1 * x1 + y1 * y1);
}
double mabs(double a) { return a > 0 ? a : -a; }
double man(double x1, double y1, double x2, double y2) {
  return mabs(x2 - x1) + mabs(y2 - y1);
}
int main() {
  double a, b, c, x1, x2, y1, y2;
  double ans;
  scanf("%lf%lf%lf%lf%lf%lf%lf", &a, &b, &c, &x1, &y1, &x2, &y2);
  ans = man(x1, y1, x2, y2);
  if (a != 0 && b != 0) {
    ans =
        min(ans, diss(x1, -(a * x1 + c) / b, x2, -(a * x2 + c) / b) +
                     mabs(y1 + (a * x1 + c) / b) + mabs(y2 + (a * x2 + c) / b));
    ans =
        min(ans, diss(-(b * y1 + c) / a, y1, x2, -(a * x2 + c) / b) +
                     mabs(x1 + (b * y1 + c) / a) + mabs(y2 + (a * x2 + c) / b));
    ans =
        min(ans, diss(x1, -(a * x1 + c) / b, -(b * y2 + c) / a, y2) +
                     mabs(y1 + (a * x1 + c) / b) + mabs(x2 + (b * y2 + c) / a));
    ans =
        min(ans, diss(-(b * y1 + c) / a, y1, -(b * y2 + c) / a, y2) +
                     mabs(x1 + (b * y1 + c) / a) + mabs(x2 + (b * y2 + c) / a));
  }
  printf("%.20lf\n", ans);
}
