#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int sgn(double x) {
  if (x > eps)
    return 1;
  else if (x < -eps)
    return -1;
  return 0;
}
double ssqrt(double x) { return sqrt(max(x, 0.0)); }
struct P {
  double x, y;
  P() {}
  P(double _x, double _y) : x(_x), y(_y) {}
  P operator+(const P& a) const { return P(x + a.x, y + a.y); }
  P operator-(const P& a) const { return P(x - a.x, y - a.y); }
  P operator*(double a) const { return P(x * a, y * a); }
  P operator/(double a) const { return P(x / a, y / a); }
  double crs(const P& a) const { return x * a.y - y * a.x; }
  double dot(const P& a) const { return x * a.x + y * a.y; }
  double abs2() const { return x * x + y * y; }
  double abs() const { return sqrt(abs2()); }
  double dis(const P& a) const { return (*this - a).abs(); }
  double dis2(const P& a) const { return (*this - a).abs2(); }
  double tan() const { return atan2(y, x); }
  double rad(const P& a) const { return atan2(crs(a), dot(a)); }
  P rot90() const { return P(-y, x); }
  bool operator<(const P& a) const {
    return x < a.x - eps || x < a.x + eps && y < a.y - eps;
  }
  bool operator==(const P& a) const {
    return fabs(x - a.x) < eps && fabs(y - a.y) < eps;
  }
  void get() { cin >> x >> y; }
  void out() const { printf("%.9lf %.9lf\n", x, y); }
};
int main() {
  int a, b, c, x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  double S = (double)abs(x1 - x2) + abs(y1 - y2);
  vector<P> p1, p2;
  if (b != 0) p1.push_back(P(x1, (double)(-c - (double)a * x1) / b));
  if (a != 0) p1.push_back(P((double)(-c - (double)b * y1) / a, y1));
  if (b != 0) p2.push_back(P(x2, (double)(-c - (double)a * x2) / b));
  if (a != 0) p2.push_back(P((double)(-c - (double)b * y2) / a, y2));
  for (auto w1 : p1)
    for (auto w2 : p2)
      S = min(S, w1.dis(P(x1, y1)) + w1.dis(w2) + w2.dis(P(x2, y2)));
  printf("%.9lf\n", S);
  return 0;
}
