#include <bits/stdc++.h>
using namespace std;
double a, b, c;
double ans;
double dist(double x1, double y1, double x2, double y2) {
  return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
pair<double, double> computeX(double x) { return {x, (a * x + c) / -b}; }
pair<double, double> computeY(double y) { return {(b * y + c) / -a, y}; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b >> c;
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  ans = abs(x1 - x2) + abs(y1 - y2);
  vector<pair<double, double>> v1, v2;
  v1.push_back(computeX(x1));
  v1.push_back(computeY(y1));
  v2.push_back(computeX(x2));
  v2.push_back(computeY(y2));
  for (auto i : v1) {
    for (auto j : v2) {
      ans = min(ans, dist(x1, y1, i.first, i.second) +
                         dist(i.first, i.second, j.first, j.second) +
                         dist(j.first, j.second, x2, y2));
    }
  }
  cout << fixed << setprecision(20) << ans << "\n";
  return 0;
}
