#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long double EPS = 1e-7;
struct Point {
  long double x, y;
  Point() {}
  Point(long double x, long double y) {
    this->x = x;
    this->y = y;
  }
};
long double a, b, c;
Point s, f;
long double get_dist(Point a, Point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
long double get_dk_dist(Point a, Point b) {
  return abs(a.x - b.x) + abs(a.y - b.y);
}
long double go(Point p1, Point p2) {
  return get_dk_dist(s, p1) + get_dist(p1, p2) + get_dk_dist(p2, f);
}
long double get_x(long long p) {
  if (a == 0) {
    return INF;
  }
  return -(b * p + c) / a;
}
long double get_y(long long p) {
  if (b == 0) {
    return INF;
  }
  return -(a * p + c) / b;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b >> c;
  cin >> s.x >> s.y >> f.x >> f.y;
  long double ans = get_dk_dist(s, f);
  Point sp[] = {Point(get_x(s.y), s.y), Point(s.x, get_y(s.x))};
  Point fp[] = {Point(get_x(f.y), f.y), Point(f.x, get_y(f.x))};
  if (sp[0].x != INF) {
    if (fp[0].x != INF) {
      ans = min(ans, go(sp[0], fp[0]));
    }
    if (fp[1].y != INF) {
      ans = min(ans, go(sp[0], fp[1]));
    }
  }
  if (sp[1].y != INF) {
    if (fp[0].x != INF) {
      ans = min(ans, go(sp[1], fp[0]));
    }
    if (fp[1].y != INF) {
      ans = min(ans, go(sp[1], fp[1]));
    }
  }
  cout << setprecision(30) << fixed << ans << endl;
  return 0;
}
