#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x, y;
};
double dist2(Point p1, Point p2) {
  double dx = p1.x - p2.x;
  double dy = p1.y - p2.y;
  return sqrt(dx * dx + dy * dy);
}
double dist1(Point p1, Point p2) {
  double dx = p1.x - p2.x;
  double dy = p1.y - p2.y;
  return abs(dx) + abs(dy);
}
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  if (a == 0) a = 0.00000001;
  if (b == 0) b = 0.00000001;
  Point p1, p2, p1x, p1y, p2x, p2y;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  p1x.x = p1.x;
  p1x.y = (-c - p1x.x * a) / b;
  p1y.y = p1.y;
  p1y.x = (-c - p1y.y * b) / a;
  p2x.x = p2.x;
  p2x.y = (-c - p2x.x * a) / b;
  p2y.y = p2.y;
  p2y.x = (-c - p2y.y * b) / a;
  double ans = dist1(p1, p2);
  ans = min(ans, dist1(p1, p1x) + dist2(p1x, p2x) + dist1(p2x, p2));
  ans = min(ans, dist1(p1, p1x) + dist2(p1x, p2y) + dist1(p2y, p2));
  ans = min(ans, dist1(p1, p1y) + dist2(p1y, p2y) + dist1(p2y, p2));
  ans = min(ans, dist1(p1, p1y) + dist2(p1y, p2x) + dist1(p2x, p2));
  printf("%.10lf", ans);
}
