#include <bits/stdc++.h>
using namespace std;
const int p = 997;
const int base = 1e9 + 7;
const int MAXN = 1000;
const int INF = 1e9;
const int MOD = 1e9;
const double PII = 3.14159265358979323846264338327950288419716939937510;
const double Epsilon = 1.19209e-01;
struct Point {
  long double x, y;
  Point() : x(0), y(0) {}
  Point(long double x0, long double y0) : x(x0), y(y0) {}
  long double dist(const Point& other) {
    return hypot(other.x - x, other.y - y);
  }
  bool operator==(const Point& other) {
    return (*this).x == other.x && (*this).y == other.y;
  }
};
struct Vector {
  long double x, y;
  Vector() : x(0), y(0) {}
  Vector(long double x0, long double y0) : x(x0), y(y0) {}
  Vector(const Point& A, const Point& B) {
    x = B.x - A.x;
    y = B.y - A.y;
  }
  long double dist() { return hypot(x, y); }
};
struct Line {
  long double a, b, c;
  Line() : a(0), b(0), c(0) {}
  Line(long double f, long double g, long double h) : a(f), b(g), c(h) {}
  Line(const Vector& f, const Point& m) {
    a = f.y;
    b = -f.x;
    c = -f.y * m.x + f.x * m.y;
  }
};
long double dot_product(const Vector& a, const Vector& b) {
  return a.x * b.x + a.y * b.y;
}
long double cross_product(const Vector& a, const Vector& b) {
  return a.x * b.y - a.y * b.x;
}
Vector operator+(const Vector& a, const Vector& b) {
  return Vector(a.x + b.x, a.y + b.y);
}
long double operator*(const Vector& a, const Vector& b) {
  return a.x * b.x + a.y * b.y;
}
ostream& operator<<(ostream& out, const Vector& a) {
  out << a.x << " " << a.y;
  return out;
}
istream& operator>>(istream& in, Vector& a) {
  in >> a.x >> a.y;
  return in;
}
istream& operator>>(istream& in, Point& a) {
  in >> a.x >> a.y;
  return in;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long double x, y, a, b, c, pyt;
  cin >> a >> b >> c;
  Line prosp(a, b, c);
  cin >> x >> y;
  Point A(x, y);
  cin >> x >> y;
  Point B(x, y);
  pyt = abs(A.x - B.x) + abs(A.y - B.y);
  Line f((long double)1, (long double)0, -A.x);
  if (!(prosp.a == f.a && prosp.b == f.b)) {
    long double r, k;
    r = (f.c * prosp.b - prosp.c * f.b) / (prosp.a * f.b - f.a * prosp.b);
    k = (f.c * prosp.a - prosp.c * f.a) / (prosp.b * f.a - f.b * prosp.a);
    Point j(r, k);
    Line d(1, 0, -B.x);
    if (!(prosp.a == d.a && prosp.b == d.b)) {
      r = (d.c * prosp.b - prosp.c * d.b) / (prosp.a * d.b - d.a * prosp.b);
      k = (d.c * prosp.a - prosp.c * d.a) / (prosp.b * d.a - d.b * prosp.a);
      Point jj(r, k);
      pyt = min(pyt, A.dist(j) + j.dist(jj) + jj.dist(B));
    }
    d = Line(0, 1, -B.y);
    if (!(prosp.a == d.a && prosp.b == d.b)) {
      r = (d.c * prosp.b - prosp.c * d.b) / (prosp.a * d.b - d.a * prosp.b);
      k = (d.c * prosp.a - prosp.c * d.a) / (prosp.b * d.a - d.b * prosp.a);
      Point jj(r, k);
      pyt = min(pyt, A.dist(j) + j.dist(jj) + jj.dist(B));
    }
  }
  f = Line((long double)0, (long double)1, -A.y);
  if (!(prosp.a == f.a && prosp.b == f.b)) {
    long double r, k;
    r = (f.c * prosp.b - prosp.c * f.b) / (prosp.a * f.b - f.a * prosp.b);
    k = (f.c * prosp.a - prosp.c * f.a) / (prosp.b * f.a - f.b * prosp.a);
    Point j(r, k);
    Line d(1, 0, -B.x);
    if (!(prosp.a == d.a && prosp.b == d.b)) {
      r = (d.c * prosp.b - prosp.c * d.b) / (prosp.a * d.b - d.a * prosp.b);
      k = (d.c * prosp.a - prosp.c * d.a) / (prosp.b * d.a - d.b * prosp.a);
      Point jj(r, k);
      pyt = min(pyt, A.dist(j) + j.dist(jj) + jj.dist(B));
    }
    d = Line(0, 1, -B.y);
    if (!(prosp.a == d.a && prosp.b == d.b)) {
      r = (d.c * prosp.b - prosp.c * d.b) / (prosp.a * d.b - d.a * prosp.b);
      k = (d.c * prosp.a - prosp.c * d.a) / (prosp.b * d.a - d.b * prosp.a);
      Point jj(r, k);
      pyt = min(pyt, A.dist(j) + j.dist(jj) + jj.dist(B));
    }
  }
  cout << fixed << setprecision(12) << pyt;
  return 0;
}
