#include <bits/stdc++.h>
using namespace std;
double mandist(double x1, double y1, double x2, double y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  long long T, x, y, z;
  T = 1;
  for (int tc = 1; tc <= T; tc++) {
    double a, b, c, x1, y1, x2, y2;
    cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
    double ans = mandist(x1, y1, x2, y2);
    double X, Y;
    c *= -1.0;
    if (a == 0 && b == 0) {
      ans = min(ans, mandist(x1, y1, 0, 0) + mandist(x2, y2, 0, 0));
    } else if (a == 0) {
      Y = (c / b);
      ans = min(ans, mandist(x1, y1, x1, Y) + dist(x1, Y, x2, Y) +
                         mandist(x2, y2, x2, Y));
    } else if (b == 0) {
      X = (c / a);
      ans = min(ans, mandist(x1, y1, X, y1) + dist(X, y1, X, y2) +
                         mandist(x2, y2, X, y2));
    } else {
      ans = min(ans, mandist(x1, y1, x1, (c - x1 * a) / b) +
                         dist(x1, (c - x1 * a) / b, x2, (c - x2 * a) / b) +
                         mandist(x2, y2, x2, (c - x2 * a) / b));
      ans = min(ans, mandist(x1, y1, x1, (c - x1 * a) / b) +
                         dist(x1, (c - x1 * a) / b, (c - y2 * b) / a, y2) +
                         mandist(x2, y2, (c - y2 * b) / a, y2));
      ans = min(ans, mandist(x1, y1, (c - y1 * b) / a, y1) +
                         dist((c - y1 * b) / a, y1, (c - y2 * b) / a, y2) +
                         mandist(x2, y2, (c - y2 * b) / a, y2));
      ans = min(ans, mandist(x1, y1, (c - y1 * b) / a, y1) +
                         dist((c - y1 * b) / a, y1, x2, (c - x2 * a) / b) +
                         mandist(x2, y2, x2, (c - x2 * a) / b));
    }
    printf("%.10f\n", ans);
  }
}
