#include <bits/stdc++.h>
using namespace std;
double dist(double X1, double X2, double Y1, double Y2) {
  return sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));
}
int main() {
  double a, b, c, w, x, y, z, d, x1, x2, y1, y2, x_1, x_2, y_1, y_2;
  cin >> a >> b >> c;
  cin >> w >> x >> y >> z;
  d = abs(w - y) + abs(x - z);
  if (a == 0 || b == 0) {
  } else {
    if (w < y)
      x1 = w, y1 = x, x2 = y, y2 = z;
    else
      x2 = w, y2 = x, x1 = y, y1 = z;
    x_1 = (-c - b * y1) / a;
    x_2 = (-c - b * y2) / a;
    y_1 = (-c - a * x1) / b;
    y_2 = (-c - a * x2) / b;
    d = min(d,
            min(min(abs(x1 - x_1) + dist(x_1, x2, y1, y_2) + abs(y2 - y_2),
                    abs(y_1 - y1) + dist(x1, x2, y_1, y_2) + abs(y_2 - y2)),
                min(abs(x1 - x_1) + dist(x2, x_1, y1, y2) + abs(x2 - x_2),
                    abs(y_1 - y1) + dist(x1, x_2, y_1, y2) + abs(x2 - x_2))));
    d = min(d, abs(x1 - x_1) + dist(x_1, x_2, y1, y2) + abs(x2 - x_2));
  }
  printf("%0.10lf", d);
  return 0;
}
