#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
struct point {
  double x, y;
  point() { x = y = 0.0; }
  point(double _x, double _y) : x(_x), y(_y) {}
};
struct vec {
  double x, y;
  vec(double _x, double _y) : x(_x), y(_y) {}
};
struct line {
  double a, b, c;
  double get_y_with_x(double x) { return -(a * x + c) / b; }
  double get_x_with_y(double y) { return -(b * y + c) / a; }
  line() { a = b = c = 0.0; }
  line(double _a, double _b, double _c) : a(_a), b(_b), c(_c) {}
};
double dist(point p1, point p2) { return hypot(p1.x - p2.x, p1.y - p2.y); }
void pointsToLine(point p1, point p2, line &l) {
  if (fabs(p1.x - p2.x) < EPS) {
    l.a = 1.0;
    l.b = 0.0;
    l.c = -p1.x;
  } else {
    l.a = -(double)(p1.y - p2.y) / (p1.x - p2.x);
    l.b = 1.0;
    l.c = -(double)(l.a * p1.x) - p1.y;
  }
}
vec to_vec(point a, point b) { return vec(b.x - a.x, b.y - a.y); }
vec scale(vec v, double s) { return vec(v.x * s, v.y * s); }
point translate(point p, vec v) { return point(p.x + v.x, p.y + v.y); }
double dot(vec a, vec b) { return (a.x * b.x + a.y * b.y); }
double norm_sq(vec v) { return v.x * v.x + v.y * v.y; }
double distToLine(point p, point a, point b) {
  vec ap = to_vec(a, p), ab = to_vec(a, b);
  double u = dot(ap, ab) / norm_sq(ab);
  point c = translate(a, scale(ab, u));
  return dist(p, c);
}
const double PI = acos(-1);
int a, b, c;
point A, B;
int main() {
  while (~scanf("%d %d %d", &a, &b, &c)) {
    scanf("%lf %lf %lf %lf", &A.x, &A.y, &B.x, &B.y);
    line avenue(a, b, c);
    double ans_case_1 = fabs(A.x - B.x) + fabs(A.y - B.y);
    point a_to_avenue_vertical(point(A.x, avenue.get_y_with_x(A.x)));
    point a_to_avenue_horizontal(point(avenue.get_x_with_y(A.y), A.y));
    point b_to_avenue_vertical(point(B.x, avenue.get_y_with_x(B.x)));
    point b_to_avenue_horizontal(point(avenue.get_x_with_y(B.y), B.y));
    double ans_case_2_1 = dist(A, a_to_avenue_horizontal) +
                          dist(a_to_avenue_horizontal, b_to_avenue_horizontal) +
                          dist(b_to_avenue_horizontal, B);
    double ans_case_2_2 = dist(A, a_to_avenue_horizontal) +
                          dist(a_to_avenue_horizontal, b_to_avenue_vertical) +
                          dist(b_to_avenue_vertical, B);
    double ans_case_2_3 = dist(A, a_to_avenue_vertical) +
                          dist(a_to_avenue_vertical, b_to_avenue_horizontal) +
                          dist(b_to_avenue_horizontal, B);
    double ans_case_2_4 = dist(A, a_to_avenue_vertical) +
                          dist(a_to_avenue_vertical, b_to_avenue_vertical) +
                          dist(b_to_avenue_vertical, B);
    double ans_case_2 =
        min(min(ans_case_2_1, ans_case_2_2), min(ans_case_2_3, ans_case_2_4));
    printf("%.12lf\n", min(ans_case_1, ans_case_2));
  }
  return 0;
}
