#include <bits/stdc++.h>
using namespace std;
int main() {
  long double a, b, c, x1, y1, x2, y2, ans;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  if (a == 0 || b == 0) {
    cout << fixed << setprecision(10) << fabs(x1 - x2) + fabs(y1 - y2);
    return 0;
  }
  long double xa = (-c - b * y1) / a;
  long double xb = ((-c - b * y2) / a);
  long double ya = ((-c - a * x1) / b);
  long double yb = ((-c - a * x2) / b);
  ans = fabs(x1 - xa) + fabs(x2 - xb) +
        sqrt((xa - xb) * (xa - xb) + (y1 - y2) * (y1 - y2));
  ans = min(ans, fabs(x1 - xa) + fabs(y2 - yb) +
                     sqrt((xa - x2) * (xa - x2) + (y1 - yb) * (y1 - yb)));
  ans = min(ans, fabs(y1 - ya) + fabs(y2 - yb) +
                     sqrt((x1 - x2) * (x1 - x2) + (ya - yb) * (ya - yb)));
  ans = min(ans, fabs(y1 - ya) + fabs(x2 - xb) +
                     sqrt((x1 - xb) * (x1 - xb) + (ya - y2) * (ya - y2)));
  ans = min(ans, fabs(x1 - x2) + fabs(y1 - y2));
  cout << fixed << setprecision(10) << ans;
  return 0;
}
