#include <bits/stdc++.h>
using namespace std;
int N;
long long a, b, c;
long long xA, yA, xB, yB;
struct Point {
  pair<double, double> p;
  double dist;
} A[10], B[10];
int cntA, cntB;
double Dist(double x1, double y1, double x2, double y2) {
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
void Read() {
  cin >> a >> b >> c;
  cin >> xA >> yA >> xB >> yB;
}
long long mod(long long x) { return max(x, -x); }
long long manhDist(long long a, long long b, long long c, long long d) {
  return mod(c - a) + mod(d - b);
}
void paralPointA(double x1, double y1) {
  if (a != 0) {
    double x = (-c - b * y1) / a;
    A[++cntA] = {make_pair(x, y1), Dist(xA, yA, x, y1)};
  }
}
void paralPointB(double x1, double y1) {
  if (a != 0) {
    double x = (-c - b * y1) / a;
    B[++cntB] = {make_pair(x, y1), Dist(xB, yB, x, y1)};
  }
}
void perpPointA(double x1, double y1) {
  if (b != 0) {
    double y = (-c - a * x1) / b;
    A[++cntA] = {make_pair(x1, y), Dist(xA, yA, x1, y)};
  }
}
void perpPointB(double x1, double y1) {
  if (b != 0) {
    double y = (-c - a * x1) / b;
    B[++cntB] = {make_pair(x1, y), Dist(xB, yB, x1, y)};
  }
}
void findAB() {
  double ans = (double)manhDist(xA, yA, xB, yB);
  paralPointA(xA, yA);
  perpPointA(xA, yA);
  paralPointB(xB, yB);
  perpPointB(xB, yB);
  for (int i = 1; i <= cntA; i++) {
    for (int j = 1; j <= cntB; j++) {
      ans = min(ans, A[i].dist + B[j].dist +
                         Dist(A[i].p.first, A[i].p.second, B[j].p.first,
                              B[j].p.second));
    }
  }
  cout << fixed << setprecision(15) << ans << "\n";
}
int main() {
  Read();
  findAB();
  return 0;
}
