#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b, c, x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  double res = abs(x2 - x1) + abs(y2 - y1);
  if (a == 0 || b == 0) {
    return cout << setprecision(6) << fixed << res << endl, 0;
  } else {
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        pair<double, double> p = {i == 0 ? x1 : (double)(-c - b * y1) / a,
                                  i == 1 ? y1 : (double)(-c - a * x1) / b};
        pair<double, double> q = {j == 0 ? x2 : (double)(-c - b * y2) / a,
                                  j == 1 ? y2 : (double)(-c - a * x2) / b};
        res = min(res, hypot(p.first - x1, p.second - y1) +
                           hypot(p.first - q.first, p.second - q.second) +
                           hypot(q.first - x2, q.second - y2));
      }
    }
  }
  cout << setprecision(6) << fixed << res << endl;
}
