#include <bits/stdc++.h>
using namespace std;
const int maxm = 2e3 + 23;
const int maxn = 2e5 + 35;
double dis(double first, double second, double xx, double yy) {
  return sqrt((first - xx) * (first - xx) + (second - yy) * (second - yy));
}
int main() {
  long long a, b, c, first, second, xx, yy;
  cin >> a >> b >> c >> first >> second >> xx >> yy;
  double ans = abs(first - xx) + abs(second - yy);
  if (b != 0) {
    double AY = (-a * first - c) * 1.0 / b;
    double BY = (-a * xx - c) * 1.0 / b;
    ans = min(ans, fabs(AY - second) + fabs(BY - yy) + dis(first, AY, xx, BY));
    if (a != 0) {
      double BX = (-b * yy - c) * 1.0 / a;
      ans =
          min(ans, fabs(AY - second) + fabs(BX - xx) + dis(first, AY, BX, yy));
    }
  }
  if (a != 0) {
    double AX = (-b * second - c) * 1.0 / a;
    double BX = (-b * yy - c) * 1.0 / a;
    ans = min(ans, fabs(AX - first) + fabs(BX - xx) + dis(AX, second, BX, yy));
    if (b != 0) {
      double BY = (-a * xx - c) * 1.0 / b;
      ans =
          min(ans, fabs(AX - first) + fabs(BY - yy) + dis(AX, second, xx, BY));
    }
  }
  printf("%.9f\n", ans);
  return 0;
}
