#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long inf = LLONG_MAX;
long double pi = 3.1415926536;
long double dis(long double x1, long double y1, long double x2,
                long double y2) {
  long double p = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
  p = sqrt(1.0 * p);
  return p;
}
long double slp(long long x1, long long y1, long long x2, long long y2) {
  if (x2 == x1) return inf;
  long double p = (long double)(y2 - y1) / (long double)(x2 - x1);
  return p;
}
long double solvex(long long a, long long b, long long c, long long y) {
  long double x = (long double)(-c - b * y) / (long double)a;
  return x;
}
long double solvey(long long a, long long b, long long c, long long x) {
  long double y = (long double)(-c - a * x) / (long double)b;
  return y;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tt = 1;
  while (tt--) {
    long long n, x = 0, m = 0, y = 0, k = inf;
    long long a, b, c;
    cin >> a >> b >> c;
    long long x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long double o = abs(x2 - x1) + abs(y2 - y1);
    if ((x1 == x2) || (y2 == y1) || a == 0 || b == 0) {
      cout << fixed << setprecision(12) << o << '\n';
      continue;
    }
    long double s1 = slp(x1, y1, x2, y2);
    long double s2 = -(long double)a / (long double)b;
    long long ch = (a * x1 + b * y2 + c) * (a * x2 + b * y1 + c);
    if (s1 * s2 <= 0 || ch >= 0) {
      cout << fixed << setprecision(12) << o << '\n';
      continue;
    }
    pair<long double, long double> p[4];
    p[0] = make_pair(solvex(a, b, c, y1), (long double)y1);
    p[1] = make_pair(solvex(a, b, c, y2), (long double)y2);
    p[2] = make_pair((long double)x1, solvey(a, b, c, x1));
    p[3] = make_pair((long double)x2, solvey(a, b, c, x2));
    sort(p, p + 4);
    long double ans1, ans2, ans;
    ans1 = dis((long double)x1, (long double)y1, p[1].first, p[1].second) +
           dis((long double)x2, (long double)y2, p[2].first, p[2].second);
    ans2 = dis((long double)x1, (long double)y1, p[2].first, p[2].second) +
           dis((long double)x2, (long double)y2, p[1].first, p[1].second);
    ans =
        min(ans1, ans2) + dis(p[1].first, p[1].second, p[2].first, p[2].second);
    cout << fixed << setprecision(12) << ans << '\n';
  }
}
