#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
template <typename T>
T gcd(T a, T b) {
  a = std::abs(a);
  b = std::abs(b);
  while (b > 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <typename T>
T sqr(T a) {
  return a * a;
}
inline int nxt() {
  int first;
  scanf("%d", &first);
  return first;
}
ll pw(ll a, ll n, ll mod) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
void prepare() {}
double dist(double x1, double y1, double x2, double y2) {
  double sq = sqr(x1 - x2) + sqr(y1 - y2);
  return sqrt(abs(sq));
}
vector<pair<double, double> > get(pii A, double a, double b, double c) {
  vector<pair<double, double> > r;
  r.emplace_back((double)A.first, (-c - a * A.first) / b);
  r.emplace_back((-c - b * A.second) / a, (double)A.second);
  return r;
}
void solve() {
  cout << setprecision(10) << fixed;
  int a, b, c;
  cin >> a >> b >> c;
  pii A, B;
  cin >> A.first >> A.second;
  cin >> B.first >> B.second;
  double ans = abs(A.first - B.first) * 1.0 + abs(A.second - B.second) * 1.0;
  if (a == 0 || b == 0) {
    cout << ans << "\n";
    return;
  }
  auto aa = get(A, a, b, c);
  auto bb = get(B, a, b, c);
  for (auto a1 : aa) {
    for (auto b1 : bb) {
      ans = min(ans, dist(A.first, A.second, a1.first, a1.second) +
                         dist(a1.first, a1.second, b1.first, b1.second) +
                         dist(B.first, B.second, b1.first, b1.second));
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  prepare();
  int t = 1;
  for (int i = 0; i < t; ++i) {
    solve();
  }
  return 0;
}
