#include <bits/stdc++.h>
using namespace std;
double a, b, c;
struct point {
  double x, y;
};
void build(vector<point> &P, point p) {
  if (b) P.push_back({p.x, 1.0 * (-c - a * p.x) / b});
  if (a) P.push_back({1.0 * (-c - b * p.y) / a, p.y});
}
double sqr(double x) { return x * x; }
double dist(point p1, point p2) {
  return sqrt(sqr(p1.x - p2.x) + sqr(p1.y - p2.y));
}
int main() {
  cin >> a >> b >> c;
  point p1, p2;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  vector<point> P1, P2;
  build(P1, p1);
  build(P2, p2);
  double ans = abs(p1.x - p2.x) + abs(p2.y - p1.y);
  for (auto x : P1)
    for (auto y : P2) ans = min(ans, dist(p1, x) + dist(x, y) + dist(y, p2));
  cout << fixed << setprecision(10) << ans;
  return 0;
}
