#include <bits/stdc++.h>
using namespace std;
long double cross(complex<long double> a, complex<long double> b) {
  return (conj(a) * b).imag();
}
complex<long double> inter(complex<long double> a, complex<long double> b,
                           complex<long double> c, complex<long double> d) {
  return a + (b - a) * cross(c - a, d - c) / cross(b - a, d - c);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long double aa, bb, cc;
  long double x1, y1, x2, y2;
  cin >> aa >> bb >> cc;
  cin >> x1 >> y1 >> x2 >> y2;
  complex<long double> a = {x1, y1}, b = {x2, y2};
  complex<long double> c = {x1, y2}, d = {x2, y1};
  pair<complex<long double>, complex<long double> > segs[4] = {
      {a, c}, {a, d}, {b, c}, {b, d}};
  long double ans = abs(x1 - x2) + abs(y1 - y2);
  if (aa != 0 && bb != 0) {
    complex<long double> A = {-cc / aa, 0};
    complex<long double> B =
        A + complex<long double>(0, 1) * complex<long double>(aa, bb);
    for (int64_t i = 0; i < 2; i++) {
      for (int64_t j = 2; j < 4; j++) {
        complex<long double> o1 = inter(segs[i].first, segs[i].second, A, B);
        complex<long double> o2 = inter(segs[j].first, segs[j].second, A, B);
        ans = min(ans, abs(a - o1) + abs(o1 - o2) + abs(o2 - b));
      }
    }
  }
  cout << fixed << setprecision(12);
  cout << ans << endl;
  return 0;
}
