#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const int INF = numeric_limits<int>::max();
const long long LINF = numeric_limits<long long>::max();
const long long mod = 1000 * 1000 * 1000 + 7;
double dist(pair<double, double> a, pair<double, double> b) {
  return sqrt(fabs(pow(a.first - b.first, 2) + pow(a.second - b.second, 2)));
}
void solve() {
  long long a, b, c;
  cin >> a >> b >> c;
  long long x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  if ((a == 0) || (b == 0)) {
    long long res = abs(x1 - x2) + abs(y1 - y2);
    cout << res << endl;
    return;
  }
  vector<pair<double, double> > v(2), u(2);
  v[0] = make_pair(x1, 1.0 * (-c - a * x1) / b);
  v[1] = make_pair(1.0 * (-c - b * y1) / a, y1);
  u[0] = make_pair(x2, 1.0 * (-c - a * x2) / b);
  u[1] = make_pair(1.0 * (-c - b * y2) / a, y2);
  double res = fabs(x1 - x2) + fabs(y1 - y2);
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      res =
          min(res, dist(v[i], u[j]) + dist(v[i], pair<double, double>(x1, y1)) +
                       dist(u[j], pair<double, double>(x2, y2)));
    }
  }
  printf("%0.18f\n", res);
}
int main() {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}
