#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c;
  long long int x1, x2, y1, y2;
  double ans = 1000.0 * 1000 * 1000 * 1000;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  if (a == 0 || b == 0) {
    ans = abs(y1 - y2) + abs(x1 - x2);
  } else {
    double ydwx1 = ((-a + 0.0) / (b + 0.0)) * ((x1 + 0.0)) - ((c + 0.0) / b);
    double ydwx2 = ((-a + 0.0) / (b + 0.0)) * ((x2 + 0.0)) - ((c + 0.0) / b);
    double xdwy1 = ((-b + 0.0) / (a + 0.0)) * ((y1 + 0.0)) - ((c + 0.0) / a);
    double xdwy2 = ((-b + 0.0) / (a + 0.0)) * ((y2 + 0.0)) - ((c + 0.0) / a);
    double posans1 =
        abs(y1 - ydwx1) +
        sqrt((y2 - ydwx1) * (y2 - ydwx1) + (xdwy2 - x1) * (xdwy2 - x1)) +
        abs(x2 - xdwy2);
    double posans2 =
        abs(y1 - ydwx1) +
        sqrt((ydwx2 - ydwx1) * (ydwx2 - ydwx1) + (x2 - x1) * (x2 - x1)) +
        abs(y2 - ydwx2);
    double posans3 =
        abs(x1 - xdwy1) +
        sqrt((y2 - y1) * (y2 - y1) + (xdwy2 - xdwy1) * (xdwy2 - xdwy1)) +
        abs(x2 - xdwy2);
    double posans4 =
        abs(x1 - xdwy1) +
        sqrt((ydwx2 - y1) * (ydwx2 - y1) + (x2 - xdwy1) * (x2 - xdwy1)) +
        abs(y2 - ydwx2);
    ans = min(abs(y2 + 0.0 - y1 + 0.0) + abs(x2 + 0.0 - x1 + 0.0),
              min(ans, min(posans1, (min(posans2, min(posans3, posans4))))));
  }
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}
