#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const int maxn = 4e5 + 5;
const double inf = 2e9;
double a, b, c;
double _x1, _y1, _x2, _y2;
double pointX(double y) { return ((-1 * b * y) - c) / a; }
double pointY(double x) { return ((-1 * a * x) - c) / b; }
double xdist(double x, double y) {
  double xp = pointX(y);
  return abs(x - xp);
}
double ydist(double x, double y) {
  double yp = pointY(x);
  return abs(y - yp);
}
double pythag(double xa, double ya, double xb, double yb) {
  double dx = abs(xa - xb);
  double dy = abs(ya - yb);
  return sqrt(dx * dx + dy * dy);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(9);
  cin >> a >> b >> c;
  cin >> _x1 >> _y1 >> _x2 >> _y2;
  double ans = abs(_x1 - _x2) + abs(_y1 - _y2);
  if (a != 0) {
    double xx = xdist(_x1, _y1) + pythag(pointX(_y1), _y1, pointX(_y2), _y2) +
                xdist(_x2, _y2);
    ans = min(ans, xx);
  }
  if (b != 0) {
    double yy = ydist(_x1, _y1) + pythag(_x1, pointY(_x1), _x2, pointY(_x2)) +
                ydist(_x2, _y2);
    ans = min(ans, yy);
  }
  if (a != 0 && b != 0) {
    double xy = xdist(_x1, _y1) + pythag(pointX(_y1), _y1, _x2, pointY(_x2)) +
                ydist(_x2, _y2);
    ans = min(ans, xy);
    double yx = ydist(_x1, _y1) + pythag(_x1, pointY(_x1), pointX(_y2), _y2) +
                xdist(_x2, _y2);
    ans = min(ans, yx);
  }
  cout << ans << endl;
  return 0;
}
