#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  double a, b, c;
  cin >> a >> b >> c;
  pair<double, double> A, B;
  cin >> A.first >> A.second >> B.first >> B.second;
  double ans = abs(A.first - B.first) + abs(A.second - B.second);
  vector<pair<double, double> > xx(2), yy(2);
  xx[0].first = A.first;
  xx[0].second = (-a * A.first - c) / b;
  xx[1].first = (-b * A.second - c) / a;
  xx[1].second = A.second;
  yy[0].first = B.first;
  yy[0].second = (-a * B.first - c) / b;
  yy[1].first = (-b * B.second - c) / a;
  yy[1].second = B.second;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      double nr = 0;
      if (i == 0)
        nr += abs(A.second - xx[i].second);
      else
        nr += abs(A.first - xx[i].first);
      if (j == 0)
        nr += abs(B.second - yy[j].second);
      else
        nr += abs(B.first - yy[j].first);
      nr += sqrt(pow(xx[i].first - yy[j].first, 2) +
                 pow(xx[i].second - yy[j].second, 2));
      ans = min(ans, nr);
    }
  }
  cout << fixed;
  cout.precision(10);
  cout << ans;
  return 0;
}
