#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
double dist(pair<double, double> a, pair<double, double> b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return sqrt(dx * dx + dy * dy);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b, c;
  cin >> a >> b >> c;
  pair<double, double> A, B;
  cin >> A.first >> A.second;
  cin >> B.first >> B.second;
  double ans = abs(A.first - B.first) + abs(A.second - B.second);
  if (a != 0 && b != 0) {
    pair<double, double> p1 =
        pair<double, double>(A.first, (-c - a * A.first) * 1.0 / b);
    pair<double, double> p2 =
        pair<double, double>((-c - b * A.second) * 1.0 / a, A.second);
    pair<double, double> p3 =
        pair<double, double>(B.first, (-c - a * B.first) * 1.0 / b);
    pair<double, double> p4 =
        pair<double, double>((-c - b * B.second) * 1.0 / a, B.second);
    ans = min(ans, dist(A, p1) + dist(p1, p3) + dist(p3, B));
    ans = min(ans, dist(A, p1) + dist(p1, p4) + dist(p4, B));
    ans = min(ans, dist(A, p2) + dist(p2, p3) + dist(p3, B));
    ans = min(ans, dist(A, p2) + dist(p2, p4) + dist(p4, B));
  }
  cout << fixed << setprecision(10) << ans << '\n';
  return 0;
}
