#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-12;
struct PT {
  double x, y;
  PT() {}
  PT(double x, double y) : x(x), y(y) {}
  PT(const PT &p) : x(p.x), y(p.y) {}
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(double c) const { return PT(x * c, y * c); }
  PT operator/(double c) const { return PT(x / c, y / c); }
};
double dot(PT p, PT q) { return p.x * q.x + p.y * q.y; }
double dist2(PT p, PT q) { return dot(p - q, p - q); }
double dist(PT p, PT q) { return sqrt(dot(p - q, p - q)); }
double cross(PT p, PT q) { return p.x * q.y - p.y * q.x; }
ostream &operator<<(ostream &os, const PT &p) {
  return os << "(" << p.x << "," << p.y << ")";
}
PT ComputeLineIntersection(PT a, PT b, PT c, PT d) {
  b = b - a;
  d = c - d;
  c = c - a;
  return a + b * cross(c, d) / cross(b, d);
}
double dist(PT P, PT Q, PT R, PT S) {
  return dist(P, Q) + dist(Q, R) + dist(R, S);
}
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  PT A, B;
  if (a == 0)
    A = {0, -1.0 * c / b}, B = {1, -1.0 * c / b};
  else if (b == 0)
    A = {-1.0 * c / a, 0}, B = {-1.0 * c / a, 1};
  else
    A = {-1.0 * c / a, 0}, B = {1, (-1.0 * c - a) / b};
  PT X, Y;
  cin >> X.x >> X.y >> Y.x >> Y.y;
  double ans = abs(X.x - Y.x) + abs(X.y - Y.y);
  PT Xx = ComputeLineIntersection(X, X + PT(100, 0), A, B);
  PT Xy = ComputeLineIntersection(X, X + PT(0, 100), A, B);
  PT Yx = ComputeLineIntersection(Y, Y + PT(100, 0), A, B);
  PT Yy = ComputeLineIntersection(Y, Y + PT(0, 100), A, B);
  if (a) ans = min(dist(X, Xx, Yx, Y), ans);
  if (a)
    if (b) ans = min(dist(X, Xx, Yy, Y), ans);
  if (a)
    if (b) ans = min(dist(X, Xy, Yx, Y), ans);
  if (b) ans = min(dist(X, Xy, Yy, Y), ans);
  cout << setprecision(9) << fixed << ans << endl;
}
