#include <bits/stdc++.h>
using namespace std;
double a, b, c, x[3], y[3];
double Y(double xx) {
  double yy = (-c - (a * xx)) / b;
  return yy;
}
double X(double yy) {
  double xx = (-c - (b * yy)) / a;
  return xx;
}
double D(pair<double, double> p1, pair<double, double> p2) {
  return sqrt(pow(p1.first - p2.first, 2) + pow(p1.second - p2.second, 2));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> a >> b >> c;
  cin >> x[1] >> y[1] >> x[2] >> y[2];
  double ans = abs(x[1] - x[2]) + abs(y[1] - y[2]);
  vector<pair<double, double>> v;
  vector<double> dis;
  for (int i = 1; i <= 2; ++i) {
    v.emplace_back(x[i], Y(x[i]));
    dis.push_back(abs(y[i] - Y(x[i])));
    v.emplace_back(X(y[i]), y[i]);
    dis.push_back(abs(x[i] - X(y[i])));
  }
  for (int i = 0; i <= 1; ++i) {
    for (int j = 2; j <= 3; ++j) {
      ans = min(ans, dis[i] + dis[j] + D(v[i], v[j]));
    }
  }
  cout.precision(12);
  cout << fixed << ans << '\n';
}
