#include <bits/stdc++.h>
using namespace std;
double pass1(double x1, double y1, double x2, double y2, double a, double b,
             double c) {
  double ya = -(a * x1 + c) / b;
  double yb = -(a * x2 + c) / b;
  double x = x1 - x2;
  double y = ya - yb;
  return abs(ya - y1) + abs(yb - y2) + sqrt(x * x + y * y);
}
double pass2(double x1, double y1, double x2, double y2, double a, double b,
             double c) {
  double xa = -(b * y1 + c) / a;
  double xb = -(b * y2 + c) / a;
  double y = y1 - y2;
  double x = xa - xb;
  return abs(xa - x1) + abs(xb - x2) + sqrt(x * x + y * y);
}
double pass3(double x1, double y1, double x2, double y2, double a, double b,
             double c) {
  double ya = -(a * x1 + c) / b;
  double xb = -(b * y2 + c) / a;
  double x = x1 - xb;
  double y = ya - y2;
  return abs(ya - y1) + abs(xb - x2) + sqrt(x * x + y * y);
}
double pass4(double x1, double y1, double x2, double y2, double a, double b,
             double c) {
  double yb = -(a * x2 + c) / b;
  double xa = -(b * y1 + c) / a;
  double x = x2 - xa;
  double y = yb - y1;
  return abs(yb - y2) + abs(xa - x1) + sqrt(x * x + y * y);
}
int main() {
  cout.precision(18);
  double a, b, c, x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  double mins = abs(x1 - x2) + abs(y1 - y2);
  double s = pass1(x1, y1, x2, y2, a, b, c);
  s = min(s, pass2(x1, y1, x2, y2, a, b, c));
  s = min(s, pass3(x1, y1, x2, y2, a, b, c));
  s = min(s, pass4(x1, y1, x2, y2, a, b, c));
  if (s < mins) mins = s;
  cout << mins;
}
