#include <bits/stdc++.h>
using namespace std;
long double dist(long double a, long double b, long double c, long double d) {
  return abs(a - c) + abs(b - d);
}
long double dist2(long double a, long double b, long double c, long double d) {
  return sqrtl((a - c) * (a - c) + (b - d) * (b - d));
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cout.precision(12);
  cout << fixed;
  long double a, b, c, x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  long double ans = dist(x1, y1, x2, y2);
  if (min(a, b) == 0) {
    cout << ans << "\n";
    return 0;
  }
  vector<pair<long double, long double>> v;
  v.push_back({x1, (-c - a * x1) / b});
  v.push_back({x2, (-c - a * x2) / b});
  v.push_back({(-c - b * y1) / a, y1});
  v.push_back({(-c - b * y2) / a, y2});
  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < 4; ++j) {
      long double temp =
          dist(x1, y1, v[i].first, v[i].second) +
          dist2(v[i].first, v[i].second, v[j].first, v[j].second) +
          dist(v[j].first, v[j].second, x2, y2);
      ans = min(ans, temp);
    }
  cout << ans << "\n";
  return 0;
}
