#include <bits/stdc++.h>
using namespace std;
struct Line {
  double a, b, c;
  void read() { cin >> a >> b >> c; }
};
struct Vector {
  double x, y;
  void read() { cin >> x >> y; }
};
Vector cl(Line l1, Line l2) {
  double x = (l1.c * l2.b - l2.c * l1.b) / (l2.a * l1.b - l1.a * l2.b);
  double y = (l2.c * l1.a - l1.c * l2.a) / (l1.b * l2.a - l2.b * l1.a);
  return Vector{x, y};
}
double dist(Vector a, Vector b) {
  double dist = sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
  return dist;
}
double const q = 1e-7;
int main() {
  Line line;
  line.read();
  Vector A, B;
  A.read(), B.read();
  vector<double> ans;
  ans.push_back(abs(A.x - B.x) + abs(A.y - B.y));
  if (line.a != 0 && line.b != 0) {
    Line ax{1, 0, -A.x};
    Line ay{0, 1, -A.y};
    Line bx{1, 0, -B.x};
    Line by{0, 1, -B.y};
    Vector M = cl(ay, line);
    Vector N = cl(ax, line);
    Vector K = cl(by, line);
    Vector E = cl(bx, line);
    double AM = dist(A, M);
    double AN = dist(A, N);
    double BE = dist(B, E);
    double BK = dist(B, K);
    double MK = dist(M, K);
    double ME = dist(M, E);
    double NK = dist(N, K);
    double NE = dist(N, E);
    ans.push_back(AM + MK + BK);
    ans.push_back(AM + ME + BE);
    ans.push_back(AN + NK + BK);
    ans.push_back(AN + NE + BE);
  }
  double ans_ = ans[0];
  for (auto i : ans) {
    if (ans_ > i + q) {
      ans_ = i;
    }
  }
  cout.precision(7);
  cout << fixed << ans_;
}
