#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void pre() {}
void solve() {}
long double dist(pair<long double, long double> a,
                 pair<long double, long double> b) {
  return sqrt((a.first - b.first) * (a.first - b.first) +
              (a.second - b.second) * (a.second - b.second));
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  pre();
  int a, b, c;
  cin >> a >> b >> c;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long double ans = 1.0 * abs(x1 - x2) + 1.0 * abs(y1 - y2);
  vector<pair<long double, pair<long double, long double>>> v, u;
  if (a != 0) {
    v.push_back(make_pair(abs(x1 - (-1.0 * b * y1 - c) / a),
                          make_pair((-1.0 * b * y1 - c) / a, y1)));
    u.push_back(make_pair(abs(x2 - (-1.0 * b * y2 - c) / a),
                          make_pair((-1.0 * b * y2 - c) / a, y2)));
  }
  if (b != 0) {
    v.push_back(make_pair(abs(y1 - (-1.0 * a * x1 - c) / b),
                          make_pair(x1, (-1.0 * a * x1 - c) / b)));
    u.push_back(make_pair(abs(y2 - (-1.0 * a * x2 - c) / b),
                          make_pair(x2, (-1.0 * a * x2 - c) / b)));
  }
  for (auto& i : v) {
    for (auto& j : u) {
      ans = min(ans, i.first + j.first + dist(i.second, j.second));
    }
  }
  cout << setprecision(20) << ans;
  return 0;
}
