#include <bits/stdc++.h>
using namespace std;
double dist(double xx1, double yy1, double xx2, double yy2) {
  return sqrt(pow(xx1 - xx2, 2) + pow(yy1 - yy2, 2));
}
int main() {
  double a, b, c, x1, yy1, x2, y2;
  cin >> a >> b >> c;
  cin >> x1 >> yy1 >> x2 >> y2;
  double aX = 1.0 * (-c - b * yy1) / a;
  double aY = 1.0 * (-c - a * x1) / b;
  double bX = 1.0 * (-c - b * y2) / a;
  double bY = 1.0 * (-c - a * x2) / b;
  double result = abs(x1 - x2) + abs(yy1 - y2);
  double d1 = abs(x1 - aX) + dist(aX, yy1, bX, y2) + abs(bX - x2);
  double d2 = abs(x1 - aX) + dist(aX, yy1, x2, bY) + abs(bY - y2);
  double d3 = abs(yy1 - aY) + dist(x1, aY, bX, y2) + abs(bX - x2);
  double d4 = abs(yy1 - aY) + dist(x1, aY, x2, bY) + abs(bY - y2);
  result = min(result, d1);
  result = min(result, d2);
  result = min(result, d3);
  result = min(result, d4);
  printf("%.10f\n", result);
  return 0;
}
