#include <bits/stdc++.h>
using namespace std;
int main() {
  long double a, b, c, x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  complex<long double> A(x1, y1), B(x2, y2), p1, p2, p3, p4;
  long double ans = abs(x1 - x2) + abs(y2 - y1);
  if (a) {
    p1 = complex<long double>((-c - (y1 * b)) / a, y1);
    p3 = complex<long double>((-c - (y2 * b)) / a, y2);
  }
  if (b) {
    p2 = complex<long double>(x1, (-c - (x1 * a)) / b);
    p4 = complex<long double>(x2, (-c - (x2 * a)) / b);
  }
  if (!a || !b) return cout << fixed << setprecision(12) << ans, 0;
  long double option1, option2, option3, option4;
  option1 = abs(A - p1) + abs(p1 - p3) + abs(p3 - B);
  option2 = abs(A - p2) + abs(p2 - p4) + abs(p4 - B);
  option3 = abs(A - p1) + abs(p1 - p4) + abs(p4 - B);
  option4 = abs(A - p2) + abs(p2 - p3) + abs(p3 - B);
  cout << fixed << setprecision(12)
       << min(ans, min(option1, min(option2, min(option3, option4)))) << endl;
  return 0;
}
