#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
double findx(long long y) {
  double num = -1 * ((double)b * (double)y + (double)c);
  return num / a;
}
double findy(long long x) {
  double num = -1 * ((double)a * (double)x + (double)c);
  return num / b;
}
double dist(pair<double, double> p1, pair<double, double> p2) {
  double a2 = pow(abs(p1.first - p2.first), 2.0),
         b2 = pow(abs(p1.second - p2.second), 2.0);
  return pow(a2 + b2, 0.5);
}
int32_t main() {
  cin >> a >> b >> c;
  long long x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long long ans = abs(x2 - x1) + abs(y2 - y1);
  double dans = (double)ans;
  if (a == 0 || b == 0) {
    cout << ans << endl;
    return 0;
  }
  double ax = findx(y1), ay = findy(x1), bx = findx(y2), by = findy(x2);
  bool changed = false;
  double cand1 = abs((double)x1 - ax) +
                 dist({ax, (double)y1}, {(double)x2, by}) +
                 abs(by - (double)y2);
  if (cand1 < dans) {
    changed = true;
    dans = cand1;
  }
  double cand2 = abs((double)x1 - ax) +
                 dist({ax, (double)y1}, {bx, (double)y2}) +
                 abs(bx - (double)x2);
  if (cand2 < dans) {
    changed = true;
    dans = cand2;
  }
  double cand3 = abs((double)y1 - ay) +
                 dist({(double)x1, ay}, {(double)x2, by}) +
                 abs(by - (double)y2);
  if (cand3 < dans) {
    changed = true;
    dans = cand3;
  }
  double cand4 = abs((double)y1 - ay) +
                 dist({(double)x1, ay}, {bx, (double)y2}) +
                 abs(bx - (double)x2);
  if (cand4 < dans) {
    changed = true;
    dans = cand4;
  }
  if (changed) {
    printf("%.10f\n", dans);
  } else {
    cout << ans << endl;
  }
  return 0;
}
