#include <bits/stdc++.h>
using namespace std;
typedef pair<pair<long double, long double>, long double> projection;
long double dist(pair<long double, long double> a,
                 pair<long double, long double> b) {
  return sqrt((a.first - b.first) * (a.first - b.first) +
              (a.second - b.second) * (a.second - b.second));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long lla, llb, llc;
  cin >> lla >> llb >> llc;
  long double a = lla, b = llb, c = llc;
  pair<long double, long double> st, fn;
  cin >> st.first >> st.second >> fn.first >> fn.second;
  long double ans = abs(st.first - fn.first) + abs(st.second - fn.second);
  vector<projection> st_proj, fn_proj;
  if (lla != 0) {
    long double st_proj_x = -(c + b * st.second) / a;
    st_proj.emplace_back(make_pair(st_proj_x, st.second),
                         abs(st.first - st_proj_x));
    long double fn_proj_x = -(c + b * fn.second) / a;
    fn_proj.emplace_back(make_pair(fn_proj_x, fn.second),
                         abs(fn.first - fn_proj_x));
  }
  if (llb != 0) {
    long double st_proj_y = -(c + a * st.first) / b;
    st_proj.emplace_back(make_pair(st.first, st_proj_y),
                         abs(st.second - st_proj_y));
    long double fn_proj_y = -(c + a * fn.first) / b;
    fn_proj.emplace_back(make_pair(fn.first, fn_proj_y),
                         abs(fn.second - fn_proj_y));
  }
  for (auto st_p : st_proj) {
    for (auto fn_p : fn_proj) {
      ans = min(ans, st_p.second + fn_p.second + dist(st_p.first, fn_p.first));
    }
  }
  cout << setprecision(16) << ans << endl;
  return 0;
}
