#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1e9 + 7;
const int64_t N = 1e6 + 5;
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  long double dx = abs(x1 - x2);
  long double dy = abs(y1 - y2);
  return sqrtl(dx * dx + dy * dy);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int64_t a, b, c;
  cin >> a >> b >> c;
  int64_t x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  pair<long double, long double> ap1;
  pair<long double, long double> ap2;
  pair<long double, long double> bp1;
  pair<long double, long double> bp2;
  if (a == 0 || b == 0) {
    long double ans = (long double)(abs(x1 - x2) + abs(y1 - y2));
    cout << setprecision(15) << ans << "\n";
    return 0;
  }
  ap1 = {1.0 * (-c - b * y1) / a, y1};
  ap2 = {x1, 1.0 * (-c - a * x1) / b};
  bp1 = {1.0 * (-c - b * y2) / a, y2};
  bp2 = {x2, 1.0 * (-c - a * x2) / b};
  long double ans = dist(x1, y1, ap1.first, ap1.second) +
                    dist(ap1.first, ap1.second, bp1.first, bp1.second) +
                    dist(bp1.first, bp1.second, x2, y2);
  ans = min(ans, dist(x1, y1, ap2.first, ap2.second) +
                     dist(ap2.first, ap2.second, bp1.first, bp1.second) +
                     dist(bp1.first, bp1.second, x2, y2));
  ans = min(ans, dist(x1, y1, ap1.first, ap1.second) +
                     dist(ap1.first, ap1.second, bp2.first, bp2.second) +
                     dist(bp2.first, bp2.second, x2, y2));
  ans = min(ans, dist(x1, y1, ap2.first, ap2.second) +
                     dist(ap2.first, ap2.second, bp2.first, bp2.second) +
                     dist(bp2.first, bp2.second, x2, y2));
  ans = min(ans, (long double)(abs(x1 - x2) + abs(y1 - y2)));
  cout << setprecision(15) << ans;
  return 0;
}
