#include <bits/stdc++.h>
using namespace std;
double A, B, C;
double x_intersect(double y) { return -(B * y + C) / A; }
double y_intersect(double x) { return -(A * x + C) / B; }
double euclidean(double x1, double y1, double x2, double y2) {
  double dx = x1 - x2;
  double dy = y1 - y2;
  return sqrt(dx * dx + dy * dy);
}
int main() {
  double X1, Y1, X2, Y2;
  cin >> A >> B >> C;
  cin >> X1 >> Y1 >> X2 >> Y2;
  double answer = abs(X1 - X2) + abs(Y1 - Y2);
  if (A == 0 || B == 0) {
    printf("%.12lf\n", answer);
    return 0;
  }
  double x_line1 = x_intersect(Y1);
  double y_line1 = y_intersect(X1);
  double x_line2 = x_intersect(Y2);
  double y_line2 = y_intersect(X2);
  answer = min(answer, abs(X1 - x_line1) + abs(X2 - x_line2) +
                           euclidean(x_line1, Y1, x_line2, Y2));
  answer = min(answer, abs(X1 - x_line1) + abs(Y2 - y_line2) +
                           euclidean(x_line1, Y1, X2, y_line2));
  answer = min(answer, abs(Y1 - y_line1) + abs(X2 - x_line2) +
                           euclidean(X1, y_line1, x_line2, Y2));
  answer = min(answer, abs(Y1 - y_line1) + abs(Y2 - y_line2) +
                           euclidean(X1, y_line1, X2, y_line2));
  printf("%.12lf\n", answer);
}
