#include <bits/stdc++.h>
using namespace std;
double a, b, c;
double Fx(double y) { return (-c - b * y) / a; }
double Fy(double x) { return (-c - a * x) / b; }
double Distance(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  cin >> a >> b >> c;
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  double ans = fabs(x1 - x2) + fabs(y1 - y2);
  if (!a || !b) {
    printf("%.8f", ans);
    return 0;
  }
  double X1, Y1, X2, Y2;
  X1 = Fx(y1);
  X2 = Fx(y2);
  ans = min(ans, fabs(x1 - X1) + Distance(X1, y1, X2, y2) + fabs(X2 - x2));
  Y2 = Fy(x2);
  ans = min(ans, fabs(x1 - X1) + Distance(X1, y1, x2, Y2) + fabs(Y2 - y2));
  Y1 = Fy(x1);
  X2 = Fx(y2);
  ans = min(ans, fabs(y1 - Y1) + Distance(x1, Y1, X2, y2) + fabs(X2 - x2));
  Y2 = Fy(x2);
  ans = min(ans, fabs(y1 - Y1) + Distance(x1, Y1, x2, Y2) + fabs(y2 - Y2));
  printf("%.8f", ans);
  return 0;
}
