#include <bits/stdc++.h>
using namespace std;
vector<long double> ar(5);
double a, b, c;
double manhattan_distance(double x1, double y1, double x2, double y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
double get_x(int y) { return (-b * y - c) / a; }
double get_y(int x) { return (-a * x - c) / b; }
double ro(double ax, double ay, double bx, double by) {
  return sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
}
double min_l() {
  double ret = ar[0];
  for (int i = 1; i < 5; i++) {
    if (ar[i] < ret) ret = ar[i];
  }
  return ret;
}
int main() {
  cout.precision(13);
  double x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  ar[0] = manhattan_distance(x1, y1, x2, y2);
  if (a == 0 || b == 0) {
    cout << ar[0];
  } else {
    ar[1] = abs(x1 - get_x(y1)) + abs(x2 - get_x(y2)) +
            ro(get_x(y1), y1, get_x(y2), y2);
    ar[2] = abs(y1 - get_y(x1)) + abs(y2 - get_y(x2)) +
            ro(x1, get_y(x1), x2, get_y(x2));
    ar[3] = abs(x1 - get_x(y1)) + abs(y2 - get_y(x2)) +
            ro(get_x(y1), y1, x2, get_y(x2));
    ar[4] = abs(y1 - get_y(x1)) + abs(x2 - get_x(y2)) +
            ro(x1, get_y(x1), get_x(y2), y2);
    cout << '\n' << min_l();
  }
  return 0;
}
