#include <bits/stdc++.h>
using namespace std;
double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  double answer = abs(x1 - x2) + abs(y1 - y2);
  if (b != 0 && a != 0) {
    double p1, q1, p2, q2;
    p1 = x1;
    q1 = (-c - a * x1) / b;
    p2 = x2;
    q2 = (-c - a * x2) / b;
    answer = min(answer, abs(y1 - q1) + abs(y2 - q2) + dist(p1, q1, p2, q2));
    q2 = y2;
    p2 = (-c - b * y2) / a;
    answer = min(answer, abs(y1 - q1) + abs(x2 - p2) + dist(p1, q1, p2, q2));
    q1 = y1;
    p1 = (-c - b * y1) / a;
    answer = min(answer, abs(x1 - p1) + abs(x2 - p2) + dist(p1, q1, p2, q2));
    p2 = x2;
    q2 = (-c - a * x2) / b;
    answer = min(answer, abs(x1 - p1) + abs(y2 - q2) + dist(p1, q1, p2, q2));
  }
  cout << setprecision(7) << fixed << answer;
  return 0;
}
