#include <bits/stdc++.h>
using namespace std;
struct pt {
  long double x, y;
};
pt a, b, au, ar, bu, br;
long double n, m, c, res = 1e18;
long double manhet(pt u, pt v) { return fabs(u.x - v.x) + fabs(u.y - v.y); }
long double euclid(pt u, pt v) {
  return sqrt((u.x - v.x) * (u.x - v.x) + (u.y - v.y) * (u.y - v.y));
}
void solve() {
  cin >> n >> m >> c;
  cin >> a.x >> a.y >> b.x >> b.y;
  res = fabs(a.x - b.x) + fabs(a.y - b.y);
  if (fabs(m) > 0.4444 && fabs(n) > 0.4444) {
    au = (pt){a.x, -(n * a.x + c) / m};
    ar = (pt){-(m * a.y + c) / n, a.y};
    bu = (pt){b.x, -(n * b.x + c) / m};
    br = (pt){-(m * b.y + c) / n, b.y};
    res = min(res, manhet(a, au) + euclid(au, bu) + manhet(bu, b));
    res = min(res, manhet(a, au) + euclid(au, br) + manhet(br, b));
    res = min(res, manhet(a, ar) + euclid(ar, bu) + manhet(bu, b));
    res = min(res, manhet(a, ar) + euclid(ar, br) + manhet(br, b));
  }
  cout << setprecision(8) << fixed << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
