#include <bits/stdc++.h>
using namespace std;
long double rasst(pair<long double, long double> A,
                  pair<long double, long double> B) {
  return sqrt((A.first - B.first) * (A.first - B.first) +
              (A.second - B.second) * (A.second - B.second));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long A, B, C;
  pair<long long, long long> S, T;
  cin >> A >> B >> C >> S.first >> S.second >> T.first >> T.second;
  if (A == 0 || B == 0)
    cout << abs(T.first - S.first) + abs(T.second - S.second), exit(0);
  long double ans = abs(T.first - S.first) + abs(T.second - S.second);
  pair<long double, long double> a =
      make_pair(S.first, 1.0 * (-A * S.first - C) / B);
  pair<long double, long double> b =
      make_pair(1.0 * (-B * S.second - C) / A, S.second);
  pair<long double, long double> c =
      make_pair(T.first, 1.0 * (-A * T.first - C) / B);
  pair<long double, long double> d =
      make_pair(1.0 * (-B * T.second - C) / A, T.second);
  ans = min(ans,
            abs(S.second - a.second) + rasst(a, c) + abs(c.second - T.second));
  ans =
      min(ans, abs(S.second - a.second) + rasst(a, d) + abs(d.first - T.first));
  ans =
      min(ans, abs(S.first - b.first) + rasst(b, c) + abs(c.second - T.second));
  ans = min(ans, abs(S.first - b.first) + rasst(b, d) + abs(d.first - T.first));
  cout.precision(12);
  cout << fixed << ans;
  return 0;
}
