#include <bits/stdc++.h>
using namespace std;
long double sq(long double a) { return a * a; }
long double dist(pair<long double, long double> a,
                 pair<long double, long double> b) {
  return sqrt((long double)(sq(a.second - b.second) + sq(a.first - b.first)));
}
long double mandist(pair<long long, long long> a,
                    pair<long long, long long> b) {
  return abs(a.second - b.second) + abs(a.first - b.first);
}
long long a, b, c;
pair<long long, long long> p1, p2;
int main() {
  scanf(" %lld%lld%lld", &a, &b, &c);
  scanf(" %lld%lld%lld%lld", &p1.first, &p1.second, &p2.first, &p2.second);
  if (a == 0 || b == 0)
    printf("%.20Lf\n", mandist(p1, p2));
  else {
    long double res = mandist(p1, p2);
    long double interhoriz1 =
        ((long double)(-c - a * p1.first)) / ((long double)b);
    long double interhoriz2 =
        ((long double)(-c - a * p2.first)) / ((long double)b);
    long double intervert1 =
        ((long double)(-c - b * p1.second)) / ((long double)a);
    long double intervert2 =
        ((long double)(-c - b * p2.second)) / ((long double)a);
    res = min(res, abs((long double)p1.second - interhoriz1) +
                       abs((long double)p2.second - interhoriz2) +
                       dist(make_pair((long double)p1.first, interhoriz1),
                            make_pair((long double)p2.first, interhoriz2)));
    res = min(res, abs((long double)p1.second - interhoriz1) +
                       abs((long double)p2.first - intervert2) +
                       dist(make_pair((long double)p1.first, interhoriz1),
                            make_pair(intervert2, (long double)p2.second)));
    res = min(res, abs((long double)p1.first - intervert1) +
                       abs((long double)p2.first - intervert2) +
                       dist(make_pair(intervert1, (long double)p1.second),
                            make_pair(intervert2, (long double)p2.second)));
    res = min(res, abs((long double)p1.first - intervert1) +
                       abs((long double)p2.second - interhoriz2) +
                       dist(make_pair(intervert1, (long double)p1.second),
                            make_pair((long double)p2.first, interhoriz2)));
    printf("%.20Lf\n", res);
  }
}
