#include <bits/stdc++.h>
using namespace std;
struct P {
  double x, y;
  double operator+(const P& a) const { return abs(a.x - x) + abs(a.y - y); }
  double operator*(const P& a) const {
    return sqrt((a.x - x) * (a.x - x) + (a.y - y) * (a.y - y));
  }
};
double a, b, c, res;
P A, B;
P Ax, Ay, Bx, By;
int main() {
  cout.precision(30);
  cin >> a >> b >> c;
  cin >> A.x >> A.y >> B.x >> B.y;
  res = A + B;
  if (!a || !b) {
    cout << res;
    return 0;
  }
  Ax = (P){A.x, (-c - a * A.x) / b};
  Ay = (P){(-c - b * A.y) / a, A.y};
  Bx = (P){B.x, (-c - a * B.x) / b};
  By = (P){(-c - b * B.y) / a, B.y};
  res = min(res, (A + Ax) + (Ax * Bx) + (B + Bx));
  res = min(res, (A + Ax) + (Ax * By) + (B + By));
  res = min(res, (A + Ay) + (Ay * Bx) + (B + Bx));
  res = min(res, (A + Ay) + (Ay * By) + (B + By));
  cout << res;
  return 0;
}
