#include <bits/stdc++.h>
using namespace std;
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  long double a, b, c;
  long double x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  if (a == 0) {
    long double A_inter_y = (-c - a * x1) / b;
    long double B_inter_y = (-c - a * x2) / b;
    long double d1 = dist(x1, A_inter_y, x2, B_inter_y);
    cout << fixed << setprecision(12)
         << min(d1 + abs(y1 - A_inter_y) + abs(y2 - B_inter_y),
                abs(x1 - x2) + abs(y1 - y2));
    return 0;
  } else if (b == 0) {
    long double A_inter_x = (-c - b * y1) / a, B_inter_x = (-c - b * y2) / a;
    long double d4 = dist(A_inter_x, y1, B_inter_x, y2);
    cout << fixed << setprecision(12)
         << min(d4 + abs(x1 - A_inter_x) + abs(x2 - B_inter_x),
                abs(x1 - x2) + abs(y1 - y2));
    return 0;
  }
  long double A_inter_y = (-c - a * x1) / b, A_inter_x = (-c - b * y1) / a;
  long double B_inter_y = (-c - a * x2) / b, B_inter_x = (-c - b * y2) / a;
  long double d1 = dist(x1, A_inter_y, x2, B_inter_y),
              d2 = dist(x1, A_inter_y, B_inter_x, y2),
              d3 = dist(A_inter_x, y1, x2, B_inter_y),
              d4 = dist(A_inter_x, y1, B_inter_x, y2);
  vector<pair<long double, string> > d = {
      {d1, "1"}, {d2, "2"}, {d3, "3"}, {d4, "4"}};
  sort(d.begin(), d.end());
  if (d[0].second == "1") {
    cout << fixed << setprecision(12)
         << min(d[0].first + abs(y1 - A_inter_y) + abs(y2 - B_inter_y),
                abs(x1 - x2) + abs(y1 - y2));
  } else if (d[0].second == "2") {
    cout << fixed << setprecision(12)
         << min(d[0].first + abs(y1 - A_inter_y) + abs(x2 - B_inter_x),
                abs(x1 - x2) + abs(y1 - y2));
  } else if (d[0].second == "3") {
    cout << fixed << setprecision(12)
         << min(d[0].first + abs(x1 - A_inter_x) + abs(y2 - B_inter_y),
                abs(x1 - x2) + abs(y1 - y2));
  } else {
    cout << fixed << setprecision(12)
         << min(d[0].first + abs(x1 - A_inter_x) + abs(x2 - B_inter_x),
                abs(x1 - x2) + abs(y1 - y2));
  }
  return 0;
}
