#include <bits/stdc++.h>
using namespace std;
double a, b, c, x, y, xx, yy;
double dist(double p, double q, double r, double s) {
  return sqrt((s - q) * (s - q) * 1.0 + (r - p) * (r - p) * 1.0);
}
double hori(double f) {
  if (a != 0) return (-c - f * b) * 1.0 / a;
  return 1.0;
}
double ver(double f) {
  if (b != 0) return (-c - f * a) * 1.0 / b;
  return 1.0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(20);
  cin >> a >> b >> c;
  cin >> x >> y >> xx >> yy;
  double p, q;
  p = hori(y);
  q = hori(yy);
  double ans = 1e18;
  if (a != 0) ans = dist(p, y, q, yy) * 1.0 + abs(x - p) + abs(xx - q);
  p = hori(y);
  q = ver(xx);
  if (a != 0 and b != 0)
    ans = min(ans, dist(p, y, xx, q) * 1.0 + abs(x - p) + abs(yy - q));
  p = ver(x);
  q = hori(yy);
  if (a != 0 and b != 0)
    ans = min(ans, dist(x, p, q, yy) * 1.0 + abs(y - p) + abs(xx - q));
  p = ver(x);
  q = ver(xx);
  if (b != 0)
    ans = min(ans, dist(x, p, xx, q) * 1.0 + abs(y - p) + abs(yy - q));
  ans = min(ans, abs(yy - y) + abs(xx - x));
  cout << ans << '\n';
}
