#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
struct Point {
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
};
double Dot(Point A, Point B) { return A.x * B.x + A.y * B.y; }
double Length(Point A) { return sqrt(Dot(A, A)); }
double Angle(Point A, Point B) {
  return acos(Dot(A, B) / Length(A) / Length(B));
}
Point Normal(Point A) {
  double L = Length(A);
  return Point(-A.y / L, A.x / L);
}
double Cross(Point A, Point B) { return A.x * B.y - A.y * B.x; }
Point operator+(Point A, Point B) { return Point(A.x + B.x, A.y + B.y); }
Point operator-(Point A, Point B) { return Point(A.x - B.x, A.y - B.y); }
Point operator*(Point A, double p) { return Point(A.x * p, A.y * p); }
Point operator/(Point A, double p) { return Point(A.x / p, A.y / p); }
int dcmp(double x) {
  if (fabs(x) < eps) return 0;
  return x < 0 ? -1 : 1;
}
bool operator<(const Point &a, const Point &b) {
  return a.x < b.x || (a.x == b.x && a.y < b.y);
}
bool operator==(const Point &a, const Point &b) {
  return dcmp(a.x - b.x) == 0 && dcmp(a.y - b.y) == 0;
}
double GetAngleByLength(double a, double b, double c) {
  double cosA = (b * b + c * c - a * a) / (b * c * 2);
  return acos(cosA);
}
Point Rotate(Point A, double rad) {
  return Point(A.x * cos(rad) - A.y * sin(rad),
               A.x * sin(rad) + A.y * cos(rad));
}
Point GetLineIntersection(Point P, Point v, Point Q, Point w) {
  Point u = P - Q;
  double t = Cross(w, u) / Cross(v, w);
  return P + v * t;
}
Point R;
Point v;
double solve(Point P, Point vP, Point Q, Point vQ) {
  auto X = GetLineIntersection(P, vP, R, v);
  auto Y = GetLineIntersection(Q, vQ, R, v);
  return Length(P - X) + Length(X - Y) + Length(Q - Y);
}
int main() {
  double a, b, c, x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  if (a == 0 || b == 0) {
    double ans = fabs(x1 - x2) + fabs(y1 - y2);
    printf("%.10f\n", ans);
    return 0;
  }
  R.x = 0;
  R.y = -c / b;
  v = Point(b, -a);
  double ans = fabs(x1 - x2) + fabs(y1 - y2);
  ans = min(ans, solve(Point(x1, y1), Point(1, 0), Point(x2, y2), Point(1, 0)));
  ans = min(ans, solve(Point(x1, y1), Point(1, 0), Point(x2, y2), Point(0, 1)));
  ans = min(ans, solve(Point(x1, y1), Point(0, 1), Point(x2, y2), Point(1, 0)));
  ans = min(ans, solve(Point(x1, y1), Point(0, 1), Point(x2, y2), Point(0, 1)));
  printf("%.10f\n", ans);
  return 0;
}
