#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long INF = 1e18 + 5;
const long long mod = 1e9 + 7;
double a, b, c;
struct point {
  double x, y;
};
point f, s;
double dist(point a, point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
point fndy(double x) { return {x, (-a * x - c) / b}; }
point fndx(double y) { return {(-b * y - c) / a, y}; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b >> c;
  cin >> f.x >> f.y >> s.x >> s.y;
  double ans = fabs(f.x - s.x) + fabs(f.y - s.y);
  ans = min(ans, dist(f, fndx(f.y)) + dist(s, fndx(s.y)) +
                     dist(fndx(f.y), fndx(s.y)));
  ans = min(ans, dist(f, fndy(f.x)) + dist(s, fndx(s.y)) +
                     dist(fndy(f.x), fndx(s.y)));
  ans = min(ans, dist(f, fndx(f.y)) + dist(s, fndy(s.x)) +
                     dist(fndx(f.y), fndy(s.x)));
  ans = min(ans, dist(f, fndy(f.x)) + dist(s, fndy(s.x)) +
                     dist(fndy(f.x), fndy(s.x)));
  cout.precision(9);
  cout << fixed << ans;
}
