#include <bits/stdc++.h>
using namespace std;
inline long long int max(long long int a, long long int b, long long int c) {
  return max(max(a, b), c);
}
inline long long int min(long long int a, long long int b, long long int c) {
  return min(min(a, b), c);
}
inline long long int max(long long int a, long long int b) {
  return (a > b) ? a : b;
}
inline long long int min(long long int a, long long int b) {
  return (a < b) ? a : b;
}
inline long long int add(long long int x, long long int y, long long int mod_) {
  return (x + y >= mod_) ? x + y - mod_ : x + y;
}
inline long long int mul(long long int x, long long int y, long long int mod_) {
  return ((x % mod_) * 1LL * (y % mod_)) % mod_;
}
long long int power(long long int a, long long int n) {
  long long int p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long int powm(long long int a, long long int n, long long int mod_) {
  long long int p = 1;
  while (n) {
    if (n % 2) {
      p = mul(p, a, mod_);
    }
    n >>= 1;
    a = mul(a, a, mod_);
  }
  return p % mod_;
}
long long int powi(long long int a, long long int mod_) {
  return powm(a, mod_ - 2, mod_);
}
double dis(double x1, double y1, double x2, double y2) {
  double s = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  s = sqrtl(s);
  return s;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cout << setprecision(15);
  long long int mn, mx;
  long long int n, m, t, k, i, j, sum = 0, flag = 0, cnt = 0;
  long long int x = 0, y = 0, z, l, r, q;
  int TC = 1;
  while (TC--) {
    double a, b, c;
    cin >> a >> b >> c;
    double x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    double v1, h1, v2, h2;
    if (a == 0 or b == 0) {
      double mn = abs(x1 - x2) + abs(y1 - y2);
      cout << mn;
      return 0;
    }
    v1 = b ? 1.0 * (-c - a * x1) / b - y1 : 1e12;
    h1 = a ? 1.0 * (-c - b * y1) / a - x1 : 1e12;
    v2 = b ? 1.0 * (-c - a * x2) / b - y2 : 1e12;
    h2 = a ? 1.0 * (-c - b * y2) / a - x2 : 1e12;
    double mn;
    mn = abs(x1 - x2) + abs(y1 - y2);
    double d = abs(v1) + abs(v2) + dis(x1, v1 + y1, x2, v2 + y2);
    mn = min(mn, d);
    d = abs(v1) + abs(h2) + dis(x1, v1 + y1, h2 + x2, y2);
    mn = min(mn, d);
    d = abs(h1) + abs(h2) + dis(h1 + x1, y1, h2 + x2, y2);
    mn = min(mn, d);
    d = abs(h1) + abs(v2) + dis(h1 + x1, y1, x2, v2 + y2);
    mn = min(mn, d);
    cout << mn;
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
