#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 3;
int a, b, c;
long double dist(pair<long double, long double> w1,
                 pair<long double, long double> w2) {
  long double s1 = w1.first - w2.first, s2 = w1.second - w2.second;
  return sqrt(s1 * s1 + s2 * s2);
}
bool ok;
pair<long double, long double> do_prostej(pair<int, int> w, bool pion) {
  ok = true;
  long long x1 = w.first, y1 = w.second;
  if (!pion) {
    if (a == 0) {
      if (b * y1 + c == 0) return make_pair(x1, y1);
      ok = false;
      return make_pair(inf, inf);
    }
    long double x2 = (-c - b * y1) * 1.0 / a;
    return make_pair(x2, y1);
  }
  if (b == 0) {
    if (a * x1 + c == 0) return make_pair(x1, y1);
    ok = false;
    return make_pair(inf, inf);
  }
  long double y2 = (-c - a * x1) * 1.0 / b;
  return make_pair(x1, y2);
}
long double solve() {
  int x1, y1, x2, y2;
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  auto w1 = make_pair(x1, y1), w2 = make_pair(x2, y2);
  long double ret = 1LL * abs(x1 - x2) + abs(y1 - y2);
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) {
      pair<long double, long double> d1 = do_prostej(w1, i),
                                     d2 = do_prostej(w2, j);
      if (!ok) continue;
      ret = min(ret, dist(w1, d1) + dist(d1, d2) + dist(d2, w2));
    }
  return ret;
}
int main() {
  scanf("%d %d %d", &a, &b, &c);
  printf("%.7Lf\n", solve());
}
