#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x, y;
  Point() {}
  Point(double a, double b) : x(a), y(b) {}
};
double dis(Point x, Point y) {
  return sqrt((x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y));
}
vector<Point> p, q;
int main() {
  double a, b, c;
  double x1, y1, x2, y2;
  scanf("%lf%lf%lf%lf%lf%lf%lf", &a, &b, &c, &x1, &y1, &x2, &y2);
  double ans = abs(x1 - x2) + abs(y1 - y2);
  if (a * x1 + b * y1 + c == 0)
    p.push_back(Point(x1, y1));
  else {
    if (a) p.push_back(Point((-c - b * y1) / a, y1));
    if (b) p.push_back(Point(x1, (-c - a * x1) / b));
  }
  if (a * x2 + b * y2 + c == 0)
    q.push_back(Point(x2, y2));
  else {
    if (a) q.push_back(Point((-c - b * y2) / a, y2));
    if (b) q.push_back(Point(x2, (-c - a * x2) / b));
  }
  Point s(x1, y1), t(x2, y2);
  for (int i = 0; i < p.size(); i++)
    for (int j = 0; j < q.size(); j++)
      ans = min(ans, dis(s, p[i]) + dis(p[i], q[j]) + dis(q[j], t));
  printf("%.10f\n", ans);
  return 0;
}
