#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long inf = (long long)1e18 + 7;
const int tinf = (int)1e9 + 7;
const long long mod = (long long)1e18 + 7;
void open_files() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
struct Point {
  double x, y;
  Point() = default;
  Point(double x, double y) : x(x), y(y) {}
};
struct Line {
  double A, B, C;
  Line(double A, double B, double C) : A(A), B(B), C(C) {}
};
Point crossX(Point& a, Line& l) { return Point(a.x, (-l.C - l.A * a.x) / l.B); }
Point crossY(Point& a, Line& l) { return Point((-l.C - l.B * a.y) / l.A, a.y); }
double distM(Point& a, Point& b) { return abs(a.x - b.x) + abs(a.y - b.y); }
double dist(Point& a, Point& b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  Line d(a, b, c);
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  Point A(x1, y1), B(x2, y2);
  Point AX = crossX(A, d), BX = crossX(B, d), AY = crossY(A, d),
        BY = crossY(B, d);
  double res = distM(A, B);
  res = min(res, dist(A, AX) + min(dist(AX, BX) + dist(BX, B),
                                   dist(AX, BY) + dist(BY, B)));
  res = min(res, dist(A, AY) + min(dist(AY, BX) + dist(BX, B),
                                   dist(AY, BY) + dist(BY, B)));
  cout << fixed << setprecision(8) << res << '\n';
}
