#include <bits/stdc++.h>
using namespace std;
const int INF = 1e+9;
double Pi = 3.14159265359;
double a, b, c;
double get_x(double y) { return (((-b) * y - c) / a); }
double get_y(double x) { return (((-a) * x - c) / b); }
double Dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  cin >> a >> b >> c;
  double xA, xB, yA, yB;
  cin >> xA >> yA >> xB >> yB;
  double ans1 = 0, ans2 = 0, ans3 = 0, ans4 = 0;
  double ans_MANH = abs(xA - xB) + abs(yA - yB);
  double xDG_A = get_x(yA), xDG_B = get_x(yB);
  double yDG_A = get_y(xA), yDG_B = get_y(xB);
  ans1 = Dist(xA, yA, xDG_A, yA) + Dist(xB, yB, xDG_B, yB) +
         Dist(xDG_A, yA, xDG_B, yB);
  ans2 = Dist(xA, yA, xA, yDG_A) + Dist(xB, yB, xB, yDG_B) +
         Dist(xA, yDG_A, xB, yDG_B);
  ans3 = Dist(xA, yA, xDG_A, yA) + Dist(xB, yB, xB, yDG_B) +
         Dist(xDG_A, yA, xB, yDG_B);
  ans4 = Dist(xA, yA, xA, yDG_A) + Dist(xB, yB, xDG_B, yB) +
         Dist(xA, yDG_A, xDG_B, yB);
  cout << min(ans_MANH, min(ans1, min(ans2, min(ans3, ans4))));
  return 0;
}
