#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
void doRoutine() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  srand(322179);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> arr) {
  for (int64_t i = 0; i < arr.size(); ++i) out << arr[i] << " ";
  out << endl;
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& arr) {
  for (int64_t i = 0; i < arr.size(); ++i) in >> arr[i];
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, multiset<T> a) {
  out << "{";
  for (auto x : a) {
    out << x << " ";
  }
  out << "}";
  return out;
}
double dist(pair<double, double> a, pair<double, double> b) {
  return hypot(a.first - b.first, a.second - b.second);
}
signed main() {
  doRoutine();
  cout.precision(20);
  double a, b, c;
  cin >> a >> b >> c;
  pair<double, double> A, B;
  cin >> A >> B;
  double ans = abs(A.first - B.first) + abs(A.second - B.second);
  pair<double, double> a1 = make_pair(A.first, (-c - a * A.first) / (double)b);
  pair<double, double> a2 =
      make_pair((-c - b * A.second) / (double)a, A.second);
  pair<double, double> b1 = make_pair(B.first, (-c - a * B.first) / (double)b);
  pair<double, double> b2 = make_pair((-c - b * B.second) / a, B.second);
  ans = min(ans, dist(A, a1) + dist(a1, b1) + dist(b1, B));
  ans = min(ans, dist(A, a2) + dist(a2, b1) + dist(b1, B));
  ans = min(ans, dist(A, a1) + dist(a1, b2) + dist(b2, B));
  ans = min(ans, dist(A, a2) + dist(a2, b2) + dist(b2, B));
  cout << ans << endl;
  return 0;
}
