#include <bits/stdc++.h>
using namespace std;
double ccw(pair<double, double> a, pair<double, double> b,
           pair<double, double> c) {
  return (b.first - a.first) * (c.second - a.second) -
         (b.second - a.second) * (c.first - a.first);
}
bool check(pair<double, double> a, pair<double, double> b,
           pair<double, double> c, pair<double, double> d) {
  if (ccw(a, b, c) * ccw(a, b, d) <= 0 && ccw(c, d, b) * ccw(c, d, a) <= 0)
    return 1;
  return 0;
}
double dist(pair<double, double> a, pair<double, double> b) {
  return sqrt((b.first - a.first) * (b.first - a.first) +
              (b.second - a.second) * (b.second - a.second));
}
int a, b, c;
pair<double, double> p1, p2;
int main() {
  scanf("%d %d %d", &a, &b, &c);
  getchar();
  cin >> p1.first >> p1.second >> p2.first >> p2.second;
  if (p1.first == p2.first) {
    cout << fixed << setprecision(10)
         << (max(p1.second, p2.second) - min(p1.second, p2.second)) << endl;
  } else if (p1.second == p2.second) {
    cout << fixed << setprecision(10)
         << (max(p1.first, p2.first) - min(p1.first, p2.first)) << endl;
  } else {
    pair<double, double> l1, l2;
    l1.first = min(p1.first, p2.first) - 1;
    l1.second = ((-a) * l1.first - c) / b;
    l2.first = max(p1.first, p2.first) + 1;
    l2.second = ((-a) * l2.first - c) / b;
    bool ok = 1;
    int cc = 0;
    if (check(l1, l2, p1, pair<double, double>(p1.first, p2.second))) cc++;
    if (check(l1, l2, p1, pair<double, double>(p2.first, p1.second))) cc++;
    if (cc == 2) ok = 0;
    if (check(l1, l2, p2, pair<double, double>(p1.first, p2.second))) cc++;
    if (check(l1, l2, p2, pair<double, double>(p2.first, p1.second))) cc++;
    double ans = abs(p1.first - p2.first) + abs(p1.second - p2.second);
    if ((cc == 2 && ok) ||
        (cc == 4 && (a * p1.first + b * p1.second + c == 0)) ||
        (cc == 3 && ((a * p1.first + b * p1.second + c == 0) ||
                     (a * p2.first + b * p2.second + c == 0)))) {
      pair<double, double> s1, s2;
      if (check(l1, l2, p1, pair<double, double>(p1.first, p2.second))) {
        s1.first = p1.first;
        s1.second = ((-a) * p1.first - c) / b;
      } else {
        s1.second = p1.second;
        s1.first = ((-b) * p1.second - c) / a;
      }
      if (check(l1, l2, p2, pair<double, double>(p1.first, p2.second))) {
        s2.second = p2.second;
        s2.first = ((-b) * p2.second - c) / a;
      } else {
        s2.first = p2.first;
        s2.second = ((-a) * p2.first - c) / b;
      }
      ans = min(ans, dist(p1, s1) + dist(s1, s2) + dist(s2, p2));
      ans = min(ans, dist(p1, s2) + dist(s1, s2) + dist(s1, p2));
    }
    cout << fixed << setprecision(10) << ans << endl;
  }
}
