#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using ld = long double;
const ld EPS = 1e-8;
struct pnt {
  ld x, y;
  bool read() {
    if (!(cin >> x >> y)) {
      return 0;
    }
    return 1;
  }
};
struct line {
  ld a, b, c;
  bool read() {
    if (!(cin >> a >> b >> c)) {
      return 0;
    }
    return 1;
  }
  bool inter_x(ld x, ld y, pnt& res) const {
    if (fabs(b) < EPS) {
      if (fabs(a * x + c) < EPS) {
        res = pnt{x, y};
        return 1;
      }
      return 0;
    }
    ld yy = (-a * x - c) / b;
    res = pnt{x, yy};
    return 1;
  }
  bool inter_y(ld x, ld y, pnt& res) const {
    if (fabs(a) < EPS) {
      if (fabs(b * y + c) < EPS) {
        res = pnt{x, y};
        return 1;
      }
      return 0;
    }
    ld xx = (-b * y - c) / a;
    res = pnt{xx, y};
    return 1;
  }
};
line l;
pnt A, B;
bool read() {
  if (!l.read()) {
    return 0;
  }
  assert(A.read());
  assert(B.read());
  return 1;
}
ld dist(pnt a, pnt b) { return fabs(a.x - b.x) + fabs(a.y - b.y); }
void solve() {
  ld ans = dist(A, B);
  vector<pnt> ps;
  for (pnt p : {A, B}) {
    pnt cur;
    if (l.inter_x(p.x, p.y, cur)) {
      ps.push_back(cur);
    }
    if (l.inter_y(p.x, p.y, cur)) {
      ps.push_back(cur);
    }
  }
  for (auto p1 : ps) {
    for (auto p2 : ps) {
      ld d = dist(A, p1);
      ld dx = p1.x - p2.x;
      ld dy = p1.y - p2.y;
      d += sqrt(dx * dx + dy * dy);
      d += dist(p2, B);
      ans = min(ans, d);
    }
  }
  cout << double(ans) << endl;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);
  cout << fixed;
  while (read()) {
    solve();
  }
  return 0;
}
