#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long double a, b, c;
long double sqr(long double x) { return x * x; }
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  long double val = sqr(x1 - x2) + sqr(y1 - y2);
  return sqrt(val);
}
long double findx(long double y) {
  long double val = -(b * y + c) / a;
  return val;
}
long double findy(long double x) {
  long double val = -(a * x + c) / b;
  return val;
}
void solve() {
  cin >> a >> b >> c;
  long double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long double ans = abs(x1 - x2) + abs(y1 - y2);
  vector<pair<long double, long double>> fir, sec;
  fir.push_back({x1, findy(x1)});
  fir.push_back({findx(y1), y1});
  sec.push_back({x2, findy(x2)});
  sec.push_back({findx(y2), y2});
  for (auto p : fir)
    for (auto q : sec) {
      long double val = dist(x1, y1, p.first, p.second) +
                        dist(p.first, p.second, q.first, q.second) +
                        dist(q.first, q.second, x2, y2);
      ans = min(ans, val);
    }
  cout << fixed << setprecision(10);
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  for (long long i = 1; i <= t; ++i) {
    solve();
  }
}
