#include <bits/stdc++.h>
using namespace std;
void itval(istream_iterator<string> it) {}
template <typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  itval(++it, args...);
}
const long long int MOD = 998244353;
template <typename T>
inline void print(T x) {
  cout << x << "\n";
}
template <typename T>
inline void printvec(T x) {
  for (auto a : x) cout << a << ' ';
  cout << '\n';
}
struct custom {
  bool operator()(
      const pair<pair<long long int, long long int>, long long int> &p1,
      const pair<pair<long long int, long long int>, long long int> &p2) const {
    return p1.first.first + p2.first.second < p1.first.second + p2.first.first;
  }
};
long long int get_pow(long long int a, long long int b) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
const long long int N = 2e5 + 10, inf = 1e18;
long double a, b, c;
long double put_in(long double x, long double y) { return a * x + b * y + c; }
long double getx(long double y) {
  if (a == 0) return inf;
  return (-b * y - c) / a;
}
long double gety(long double x) {
  if (b == 0) return inf;
  return (-x * a - c) / b;
}
long double dist(long double x11, long double y11, long double x2,
                 long double y2) {
  return sqrt((x11 - x2) * (x11 - x2) + (y2 - y11) * (y2 - y11));
}
void solve() {
  cin >> a >> b >> c;
  long double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  std::vector<pair<pair<long double, long double>, long double>> v1, v2;
  v1 = {{{x1, gety(x1)}, abs(y1 - gety(x1))},
        {{getx(y1), y1}, abs(getx(y1) - x1)}};
  v2 = {{{x2, gety(x2)}, abs(y2 - gety(x2))},
        {{getx(y2), y2}, abs(getx(y2) - x2)}};
  long double ans = inf;
  for (auto p : v1) {
    for (auto q : v2) {
      ans = min(ans, dist(p.first.first, p.first.second, q.first.first,
                          q.first.second) +
                         p.second + q.second);
    }
  }
  ans = min(ans, abs(x1 - x2) + abs(y1 - y2));
  cout << fixed << setprecision(10) << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  clock_t z = clock();
  for (long long int tes = (long long int)0; tes < (long long int)(test);
       tes++) {
    solve();
  }
  fprintf(stderr, "Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC),
      fflush(stderr);
  return 0;
}
