#include <bits/stdc++.h>
using namespace std;
FILE* in = stdin;
FILE* out = stdout;
const int MAX = 1024;
double a, b, c;
double findDist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void goToDiagonal(double x, double y, double& tx, double& ty, bool which) {
  if (a == 0) {
    tx = x, ty = -c / b;
    return;
  }
  if (b == 0) {
    tx = -c / a, ty = y;
    return;
  }
  if (which) {
    tx = x, ty = (-a * x - c) / b;
  } else {
    tx = (-b * y - c) / a, ty = y;
  }
}
int main(void) {
  double x1, y1, x2, y2;
  fscanf(in, "%lf %lf %lf", &a, &b, &c);
  fscanf(in, "%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
  if (x1 == x2) {
    fprintf(out, "%.12lf\n", fabs(y1 - y2));
    return 0;
  }
  if (y1 == y2) {
    fprintf(out, "%.12lf\n", fabs(x1 - x2));
    return 0;
  }
  double ans = fabs(x1 - x2) + fabs(y1 - y2);
  for (int d1 = 0; d1 < 2; d1++) {
    for (int d2 = 0; d2 < 2; d2++) {
      double m1x = -1.0, m1y = -1.0;
      double m2x = -1.0, m2y = -1.0;
      goToDiagonal(x1, y1, m1x, m1y, d1);
      goToDiagonal(x2, y2, m2x, m2y, d2);
      double cur = findDist(x1, y1, m1x, m1y) + findDist(m1x, m1y, m2x, m2y) +
                   findDist(m2x, m2y, x2, y2);
      ans = min(ans, cur);
    }
  }
  fprintf(out, "%.12lf\n", ans);
  return 0;
}
