#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
using pdd = pair<double, double>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
int main() {
  cin.sync_with_stdio(0);
  double a, b, c;
  cin >> a >> b >> c;
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  pdd l, u, r, d;
  double xl = min(x1, x2);
  double xr = max(x1, x2);
  double yu = max(y1, y2);
  double yd = min(y1, y2);
  l = {xl, -(a * xl + c) / b};
  u = {-(b * yu + c) / a, yu};
  r = {xr, -(a * xr + c) / b};
  d = {-(b * yd + c) / a, yd};
  vector<pdd> intersex;
  if (l.second > yu || l.second < yd) {
  } else {
    intersex.push_back(l);
  }
  if (r.second > yu || r.second < yd) {
  } else {
    intersex.push_back(r);
  }
  if (u.first > xr || u.first < xl) {
  } else {
    intersex.push_back(u);
  }
  if (d.first > xr || d.first < xl) {
  } else {
    intersex.push_back(d);
  }
  double res = abs(x2 - x1) + abs(y2 - y1);
  for (ll i = (0); i < (ll((intersex).size())); i++) {
    pdd i1 = intersex[i];
    double tmp;
    if (abs(i1.first - x1) < eps) {
      tmp = abs(i1.second - y1);
    } else if (abs(i1.second - y1) < eps) {
      tmp = abs(i1.first - x1);
    } else {
      continue;
    }
    for (ll j = (0); j < (ll((intersex).size())); j++) {
      pdd i2 = intersex[j];
      double tmp2;
      if (abs(i2.first - x2) < eps) {
        tmp2 = abs(i2.second - y2);
      } else if (abs(i2.second - y2) < eps) {
        tmp2 = abs(i2.first - x2);
      } else {
        continue;
      }
      res =
          min(res, tmp +
                       sqrt((i2.first - i1.first) * (i2.first - i1.first) +
                            (i2.second - i1.second) * (i2.second - i1.second)) +
                       tmp2);
    }
  }
  cout.precision(10);
  cout << fixed << res << endl;
}
