#include <bits/stdc++.h>
using namespace std;
const int xd = 1e6;
const long long mod = 1e9 + 7;
double dot(complex<double> a, complex<double> b) {
  return (conj(a) * b).real();
}
double cross(complex<double> a, complex<double> b) {
  return (conj(a) * b).imag();
}
long long fact[1000006], inv[1000006];
long long fp(long long base, long long exp) {
  if (exp == 0) return 1;
  long long ans = fp(base, exp / 2);
  ans = (ans * ans) % mod;
  if (exp % 2 != 0) ans = (ans * (base % mod)) % mod;
  return ans;
}
void calcFacAndInv(long long n) {
  fact[0] = inv[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fact[i] = (i * fact[i - 1]) % mod;
    inv[i] = fp(fact[i], mod - 2);
  }
}
long long ncr(long long n, long long r) {
  return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}
long long npr(long long n, long long r) { return (fact[n] * inv[n - r]) % mod; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  double a, b, c, x, y, x1, y1, ans1, ans2, ans3, ans4, ans5;
  cin >> a >> b >> c >> x >> y >> x1 >> y1;
  complex<double> p(x, y), p2(x1, y1);
  complex<double> al(x, (-c - (a * x)) / b);
  complex<double> a2((-c - (b * y)) / a, y);
  complex<double> bl(x1, (-c - (a * x1)) / b);
  complex<double> b2((-c - (b * y1)) / a, y1);
  ans1 = abs(x - x1) + abs(y - y1);
  ans2 = abs(p - al) + abs(al - bl) + abs(bl - p2);
  ans3 = abs(p - al) + abs(al - b2) + abs(b2 - p2);
  ans4 = abs(p - a2) + abs(a2 - b2) + abs(b2 - p2);
  ans5 = abs(p - a2) + abs(a2 - bl) + abs(bl - p2);
  cout << fixed << setprecision(10)
       << min(ans1, min(ans2, min(ans3, min(ans4, ans5))));
  return 0;
}
