#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void amax(X &x, const Y &y) {
  if (x < y) x = y;
}
template <class X, class Y>
void amin(X &x, const Y &y) {
  if (x > y) x = y;
}
const int INF = 1e9 + 10;
const long long INFL = (long long)1e18 + 10;
struct Point {
  long double x, y;
};
long double a, b, c;
Point p1, p2;
long double res;
void ans() {
  cout << fixed << setprecision(15) << res;
  exit(0);
}
long double dist(const Point &p1, const Point &p2) {
  return abs(p2.x - p1.x) + abs(p2.y - p1.y);
}
long double distr(const Point &p1, const Point &p2) {
  return sqrtl(((p2.x - p1.x) * (p2.x - p1.x)) +
               ((p2.y - p1.y) * (p2.y - p1.y)));
}
void process() {
  cin >> a >> b >> c;
  c = -c;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  res = dist(p1, p2);
  if (a == 0 || b == 0) ans();
  vector<Point> v1{{p1.x, (c - a * p1.x) / b}, {(c - b * p1.y) / a, p1.y}};
  vector<Point> v2{{p2.x, (c - a * p2.x) / b}, {(c - b * p2.y) / a, p2.y}};
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      amin(res, distr(v1[i], v2[j]) + dist(p1, v1[i]) + dist(p2, v2[j]));
  ans();
}
int main() {
  ios_base::sync_with_stdio(false);
  process();
}
