#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
struct point {
  long double x;
  long double y;
};
long double est(point A, point B) {
  return sqrt((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cout.precision(9);
  long double a, b, c;
  cin >> a >> b >> c;
  point A, B, C;
  cin >> A.x >> A.y >> B.x >> B.y;
  C.x = A.x;
  C.y = B.y;
  long double crab;
  crab = est(A, C) + est(B, C);
  point alx, aly, blx, bly;
  alx.x = -(b * A.y + c) / a;
  alx.y = A.y;
  aly.x = A.x;
  aly.y = -(a * A.x + c) / b;
  blx.x = -(b * B.y + c) / a;
  blx.y = B.y;
  bly.x = B.x;
  bly.y = -(a * B.x + c) / b;
  long double calxblx = est(alx, blx) + est(A, alx) + est(B, blx);
  long double calyblx = est(aly, blx) + est(A, aly) + est(B, blx);
  long double calxbly = est(alx, bly) + est(A, alx) + est(B, bly);
  long double calybly = est(aly, bly) + est(A, aly) + est(B, bly);
  cout << fixed << min(crab, min(calxblx, min(calxbly, min(calyblx, calybly))));
}
