#include <bits/stdc++.h>
const double INF = 1e18, eps = 1e-18;
double a, b, c, x_1, y_1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6, ans;
double sqr(double x) { return x * x; }
double dis(double x_1, double y_1, double x2, double y2) {
  return sqrt(sqr(x2 - x_1) + sqr(y_1 - y2));
}
int main() {
  scanf("%lf%lf%lf%lf%lf%lf%lf", &a, &b, &c, &x_1, &y_1, &x6, &y6);
  if (std::abs(a - 0) > eps && std::abs(b - 0) > eps)
    y2 = y_1, x2 = (-b * y2 - c) / a;
  else
    y2 = x2 = INF;
  if (std::abs(a - 0) > eps && std::abs(b - 0) > eps)
    x3 = x_1, y3 = (-a * x3 - c) / b;
  else
    x3 = y3 = INF;
  if (std::abs(a - 0) > eps && std::abs(b - 0) > eps)
    y4 = y6, x4 = (-b * y4 - c) / a;
  else
    x4 = y4 = INF;
  if (std::abs(a - 0) > eps && std::abs(b - 0) > eps)
    x5 = x6, y5 = (-a * x5 - c) / b;
  else
    x5 = y5 = INF;
  ans = std::min(
      std::min(
          std::min(
              dis(x_1, y_1, x2, y2) + dis(x2, y2, x4, y4) + dis(x4, y4, x6, y6),
              dis(x_1, y_1, x2, y2) + dis(x2, y2, x5, y5) +
                  dis(x5, y5, x6, y6)),
          dis(x_1, y_1, x3, y3) + dis(x3, y3, x4, y4) + dis(x4, y4, x6, y6)),
      dis(x_1, y_1, x3, y3) + dis(x3, y3, x5, y5) + dis(x5, y5, x6, y6));
  ans = std::min(ans, std::abs(x6 - x_1) + std::abs(y6 - y_1));
  printf("%.10lf", ans);
  return 0;
}
