#include <bits/stdc++.h>
using namespace std;
long double a, b, c;
long double y(long double x) { return (-a * x - c) / ((long double)b); }
long double x(long double y) { return (-b * y - c) / ((long double)a); }
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pair<double, double> A, B;
  cin >> a >> b >> c;
  cin >> A.first >> A.second >> B.first >> B.second;
  if (a == 0 || b == 0) {
    cout << fixed << setprecision(20)
         << abs(A.first - B.first) + abs(A.second - B.second) << endl;
  } else {
    long double aa = abs(A.first - B.first) + abs(A.second - B.second);
    long double yB = y(B.first), xB = x(B.second);
    long double yA = y(A.first), xA = x(A.second);
    long double bb = abs(yB - B.second) + abs(yA - A.second) +
                     sqrt(pow(A.first - B.first, 2) + pow(yA - yB, 2));
    long double cc = abs(yB - B.second) + abs(xA - A.first) +
                     sqrt(pow(xA - B.first, 2) + pow(A.second - yB, 2));
    long double dd = abs(xB - B.first) + abs(yA - A.second) +
                     sqrt(pow(A.first - xB, 2) + pow(yA - B.second, 2));
    long double ee = abs(xB - B.first) + abs(xA - A.first) +
                     sqrt(pow(xA - xB, 2) + pow(A.second - B.second, 2));
    long double ans = min(min(aa, bb), min(cc, min(dd, ee)));
    cout << fixed << setprecision(20) << showpoint << ans << endl;
  }
  return 0;
}
