#include <bits/stdc++.h>
using namespace std;
double calc(pair<double, double> v1, pair<double, double> v2) {
  double dx = v1.first - v2.first;
  double dy = v1.second - v2.second;
  return sqrt(dx * dx + dy * dy);
}
int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  double x1, y1, x2, y2;
  scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
  double dist = fabs(x1 - x2) + fabs(y1 - y2);
  if (a == 0 || b == 0) {
    printf("%.10f\n", dist);
    return 0;
  }
  vector<pair<double, double>> v1, v2;
  double xl1 = (-1.0 * c - 1.0 * b * y1) / a;
  double yl1 = (-1.0 * c - 1.0 * a * x1) / b;
  v1.push_back({xl1, y1});
  v1.push_back({x1, yl1});
  double xl2 = (-1.0 * c - 1.0 * b * y2) / a;
  double yl2 = (-1.0 * c - 1.0 * a * x2) / b;
  v2.push_back({xl2, y2});
  v2.push_back({x2, yl2});
  for (auto p1 : v1)
    for (auto p2 : v2)
      dist =
          min(dist, calc(p1, p2) + fabs(x1 - p1.first) + fabs(y1 - p1.second) +
                        fabs(x2 - p2.first) + fabs(y2 - p2.second));
  printf("%.10f\n", dist);
}
