#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double PI = acos(-1);
struct Point {
  double x, y;
  Point() = default;
  Point(double x, double y) : x(x), y(y) {}
  bool operator==(const Point &a) const {
    return (abs(x - a.x) <= eps && abs(y - a.y) <= eps);
  }
  Point operator+(const Point &a) const { return Point(x + a.x, y + a.y); }
  Point operator-(const Point &a) const { return Point(x - a.x, y - a.y); }
  Point operator-() const { return Point(-x, -y); }
  Point operator*(const double &k) const { return Point(k * x, k * y); }
  Point operator/(const double &k) const { return Point(x / k, y / k); }
  double operator*(const Point &a) const { return x * a.x + y * a.y; }
  double operator^(const Point &a) const { return x * a.y - y * a.x; }
  bool operator<(const Point &a) const {
    if (abs(x - a.x) <= eps) return y < a.y - eps;
    return x < a.x - eps;
  }
  bool is_par(const Point &a) const { return abs((*this) ^ a) <= eps; }
  bool is_ver(const Point &a) const { return abs((*this) * a) <= eps; }
  double len() const { return sqrt((*this) * (*this)); }
  double dis(const Point &a) const { return (a - (*this)).len(); }
  double ang(const Point &a) const {
    return acos(((*this) * a) / (this->len() * a.len()));
  }
  Point rot(const double &rad) const {
    return Point(x * cos(rad) - y * sin(rad), x * sin(rad) + y * cos(rad));
  }
};
struct Line {
  Point p, v;
  Line() = default;
  Line(Point p, Point v) : p(p), v(v) {}
  bool operator==(const Line &a) const {
    return (v.is_par(a.v) && v.is_par(p - a.p));
  }
  bool is_par(const Line &a) const {
    return (v.is_par(a.v) && !v.is_par(p - a.p));
  }
  bool is_ver(const Line &a) const { return v.is_ver(a.v); }
  Point inter(const Line &a) const {
    return p + v * ((a.v ^ (p - a.p)) / (v ^ a.v));
  }
  double dis(const Point &a) const { return abs(v ^ (a - p)) / v.len(); }
  Point proj(const Point &a) const { return p + v * ((v * (a - p)) / (v * v)); }
};
struct Segment {
  Point a, b;
  Segment() = default;
  Segment(Point a, Point b) : a(a), b(b) {}
  bool is_on(const Point &c) const {
    return ((c - a).is_par(b - c) && (c - a) * (b - c) >= -eps);
  }
  Point inter(const Segment &c) const {
    return Line(a, b - a).inter(Line(c.a, c.b - c.a));
  }
  bool is_cross(const Segment &c) {
    Point p = inter(c);
    return (is_on(p) && c.is_on(p));
  }
};
struct Polygon {
  vector<Point> p;
  Polygon() = default;
  Polygon(vector<Point> p) : p(move(p)) {}
  size_t size() const { return p.size() - 1; }
  bool is_in(const Point &a) const {
    Line l(a, Point(PI, exp(1)));
    int cnt = 0;
    for (size_t i = 0; i < p.size() - 1; i++) {
      Segment s(p[i], p[i + 1]);
      if (s.is_on(a)) return true;
      Point b = l.inter(Line(p[i], p[i + 1] - p[i]));
      if (s.is_on(b) && l.v * (b - a) >= -eps) cnt++;
    }
    return cnt & 1;
  }
  double C() const {
    double sum = 0;
    for (size_t i = 0; i < p.size() - 1; i++) sum += (p[i + 1] - p[i]).len();
    return sum;
  }
  double S() const {
    Point a(0, 0);
    double sum = 0;
    for (size_t i = 0; i < p.size() - 1; i++)
      sum += (p[i] - a) ^ (p[i + 1] - a);
    return abs(sum) / 2;
  }
};
struct Circle {
  Point c;
  double r;
  Circle() = default;
  Circle(Point c, double r) : c(c), r(r) {}
  bool operator==(const Circle &a) const { return (c == a.c && r == a.r); }
  double C() const { return 2 * PI * r; }
  double S() const { return PI * r * r; }
  vector<Point> inter(const Line &a) const {
    double d = a.dis(c);
    Point p = a.proj(c);
    if (d > r + eps) return vector<Point>();
    if (abs(d - r) <= eps) return vector<Point>{p};
    double l = sqrt(r * r - d * d);
    return vector<Point>{p + (a.v / a.v.len()) * l, p - (a.v / a.v.len()) * l};
  }
  vector<Point> inter(const Circle &a) const {
    double d = c.dis(a.c);
    Point e = a.c - c;
    e = e / e.len();
    if ((*this) == a) return vector<Point>();
    if (d > r + a.r + eps || d < abs(r - a.r) - eps) return vector<Point>();
    if (abs(d - r - a.r) <= eps) return vector<Point>{c + e * r};
    if (abs(d - abs(r - a.r)) <= eps) return vector<Point>{c - e * r};
    double th = acos((r * r + d * d - a.r * a.r) / (2 * r * d));
    return vector<Point>{c + e.rot(th) * r, c + e.rot(-th) * r};
  }
  double inter_S(const Circle &a) const {
    double d = c.dis(a.c);
    if ((*this) == a) return S();
    if (d >= r + a.r - eps) return 0;
    if (d <= abs(r - a.r) + eps) return min(S(), a.S());
    double th1 = acos((r * r + d * d - a.r * a.r) / (2 * r * d)),
           th2 = acos((a.r * a.r + d * d - r * r) / (2 * a.r * d));
    return S() * th1 / PI - r * r * cos(th1) * sin(th1) + a.S() * th2 / PI -
           a.r * a.r * cos(th2) * sin(th2);
  }
};
double a, b, c;
Point u, v;
double solve() {
  double ans = abs(u.x - v.x) + abs(u.y - v.y);
  Line l = Line(Point(0, -c / b), Point(-b, a));
  if (abs(a) <= eps || abs(b) <= eps) return ans;
  Point u1 = l.inter(Line(u, Point(1, 0)));
  Point u2 = l.inter(Line(u, Point(0, 1)));
  Point v1 = l.inter(Line(v, Point(1, 0)));
  Point v2 = l.inter(Line(v, Point(0, 1)));
  ans = min(ans, u.dis(u1) + u1.dis(v1) + v1.dis(v));
  ans = min(ans, u.dis(u1) + u1.dis(v2) + v2.dis(v));
  ans = min(ans, u.dis(u2) + u2.dis(v1) + v1.dis(v));
  ans = min(ans, u.dis(u2) + u2.dis(v2) + v2.dis(v));
  return ans;
}
int main() {
  cin >> a >> b >> c;
  cin >> u.x >> u.y >> v.x >> v.y;
  cout << fixed << setprecision(12) << solve();
  getchar();
  getchar();
  return 0;
}
