#include <bits/stdc++.h>
using namespace std;
double getdist(double xa, double ya, double xb, double yb) {
  return sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
}
long long a, b, c;
long long xa, ya, xb, yb;
int main() {
  scanf("%lld%lld%lld", &a, &b, &c);
  scanf("%lld%lld%lld%lld", &xa, &ya, &xb, &yb);
  double ans = abs(xa - xb) + abs(ya - yb);
  if (a && b) {
    double xa1 = xa, ya1 = (double)-(a * xa + c) / b;
    double ya2 = ya, xa2 = (double)-(b * ya + c) / a;
    double xb1 = xb, yb1 = (double)-(a * xb + c) / b;
    double yb2 = yb, xb2 = (double)-(b * yb + c) / a;
    double tans;
    tans = abs(ya1 - ya) + abs(yb1 - yb) + getdist(xa1, ya1, xb1, yb1);
    ans = min(ans, tans);
    tans = abs(ya1 - ya) + abs(xb2 - xb) + getdist(xa1, ya1, xb2, yb2);
    ans = min(ans, tans);
    tans = abs(xa2 - xa) + abs(yb1 - yb) + getdist(xa2, ya2, xb1, yb1);
    ans = min(ans, tans);
    tans = abs(xa2 - xa) + abs(xb2 - xb) + getdist(xa2, ya2, xb2, yb2);
    ans = min(ans, tans);
  } else if (b) {
    double xa1 = xa, ya1 = (double)-(a * xa + c) / b;
    double xb1 = xb, yb1 = (double)-(a * xb + c) / b;
    double tans;
    tans = abs(ya1 - ya) + abs(yb1 - yb) + getdist(xa1, ya1, xb1, yb1);
    ans = min(ans, tans);
  } else if (a) {
    double ya2 = ya, xa2 = (double)-(b * ya + c) / a;
    double yb2 = yb, xb2 = (double)-(b * yb + c) / a;
    double tans;
    tans = abs(xa2 - xa) + abs(xb2 - xb) + getdist(xa2, ya2, xb2, yb2);
    ans = min(ans, tans);
  }
  printf("%.10f\n", ans);
  return 0;
}
