#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
double m_dist(double x, double y, double x2, double y2) {
  return abs(x - x2) + abs(y - y2);
}
double sqr(double x) { return x * x; }
double dist(double x, double y, double x2, double y2) {
  return sqrt(sqr(x - x2) + sqr(y - y2));
}
vector<pair<double, double> > inter(double a, double b, double c, double x,
                                    double y) {
  vector<pair<double, double> > ans;
  if (a != 0) {
    double xx = -(b * y + c) / a;
    ans.push_back({xx, y});
  }
  if (b != 0) {
    double yy = -(a * x + c) / b;
    ans.push_back({x, yy});
  }
  return ans;
}
long long a, b, c;
long long x1, x2, sgnoigner, y2;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b >> c;
  cin >> x1 >> sgnoigner >> x2 >> y2;
  double sol = m_dist(x1, sgnoigner, x2, y2);
  vector<pair<double, double> > o1 = inter(a, b, c, x1, sgnoigner);
  vector<pair<double, double> > o2 = inter(a, b, c, x2, y2);
  for (auto p1 : o1) {
    for (auto p2 : o2) {
      sol = min(sol, dist(x1, sgnoigner, p1.first, p1.second) +
                         dist(p1.first, p1.second, p2.first, p2.second) +
                         dist(x2, y2, p2.first, p2.second));
    }
  }
  cout << setprecision(10) << fixed << sol << '\n';
}
