#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0LL) return b;
  if (b == 0LL) return a;
  return gcd(b, a % b);
}
long double dist(pair<long double, long double> A,
                 pair<long double, long double> B) {
  long double D = (A.first - B.first) * (A.first - B.first) +
                  (A.second - B.second) * (A.second - B.second);
  D = sqrt(D);
  return D;
}
long double a, b, c;
long double solvex(long double y) {
  if (abs(a) < 1e-9) return -log(0);
  return (-b * y - c) / a;
}
long double solvey(long double x) {
  if (abs(b) < 1e-9) return -log(0);
  return (-a * x - c) / b;
}
void solve() {
  cin >> a >> b >> c;
  pair<long double, long double> A, B;
  cin >> A.first >> A.second >> B.first >> B.second;
  pair<long double, long double> PA[3], PB[3];
  long double DA[3], DB[3];
  PA[0] = A;
  PB[0] = B;
  PA[1] = make_pair(solvex(A.second), A.second);
  PB[1] = make_pair(solvex(B.second), B.second);
  PA[2] = make_pair(A.first, solvey(A.first));
  PB[2] = make_pair(B.first, solvey(B.first));
  for (int i = 0; i < 3; i++) {
    DA[i] = dist(A, PA[i]);
    DB[i] = dist(B, PB[i]);
  }
  long double ans = abs(A.first - B.first) + abs(A.second - B.second);
  for (int i = 1; i < 3; i++)
    for (int j = 1; j < 3; j++)
      ans = min(ans, DA[i] + DB[j] + dist(PA[i], PB[j]));
  cout << ans << "\n";
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  clock_t clk = clock();
  int t = 1;
  for (int tests = 1; tests <= t; tests++) {
    solve();
  }
  clk = clock() - clk;
  cerr << "Time Elapsed: " << fixed << setprecision(10)
       << ((long double)clk) / CLOCKS_PER_SEC << "\n";
  return 0;
}
