#include <bits/stdc++.h>
using namespace std;
long long A, B, C;
long long X1, Y1, X2, Y2;
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() {
  cin >> A >> B >> C;
  cin >> X1 >> Y1 >> X2 >> Y2;
  double manhattan = abs(X1 - X2) + abs(Y1 - Y2);
  if (A == 0 || B == 0) {
    printf("%.12lf\n", manhattan);
    return 0;
  }
  double answer = manhattan;
  double x1 = x_intersect(Y1);
  double y1 = y_intersect(X1);
  double x2 = x_intersect(Y2);
  double y2 = y_intersect(X2);
  answer = min(answer, abs(X1 - x1) + abs(X2 - x2) + euclidean(x1, Y1, x2, Y2));
  answer = min(answer, abs(X1 - x1) + abs(Y2 - y2) + euclidean(x1, Y1, X2, y2));
  answer = min(answer, abs(Y1 - y1) + abs(X2 - x2) + euclidean(X1, y1, x2, Y2));
  answer = min(answer, abs(Y1 - y1) + abs(Y2 - y2) + euclidean(X1, y1, X2, y2));
  printf("%.12lf\n", answer);
}
