#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
const int N = 1e5 + 1;
long double dis(long double a, long double b, long double c, long double d) {
  return sqrt((a - c) * (a - c) + (b - d) * (b - d));
}
int main() {
  long double a, b, c, x1, y1, x2, y2, res1, res2, d1, d2, xd, yd, xc, yc, xa1,
      xa2, ya1, ya2, xb1, xb2, yb1, yb2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  res1 = abs(x1 - x2) + abs(y1 - y2);
  xd = x1;
  if (b == 0)
    yd = 1e18;
  else
    yd = (-c - a * x1) / b;
  yc = y1;
  if (a == 0)
    xc = 1e18;
  else
    xc = (-c - b * y1) / a;
  xa1 = xd;
  ya1 = yd;
  xa2 = xc;
  ya2 = yc;
  xd = x2;
  if (b == 0)
    yd = -1e18;
  else
    yd = (-c - a * x2) / b;
  yc = y2;
  if (a == 0)
    xc = -1e18;
  else
    xc = (-c - b * y2) / a;
  xb1 = xd;
  yb1 = yd;
  xb2 = xc;
  yb2 = yc;
  res1 = min(res1, dis(x1, y1, xa1, ya1) + dis(x2, y2, xb1, yb1) +
                       dis(xa1, ya1, xb1, yb1));
  res1 = min(res1, dis(x1, y1, xa2, ya2) + dis(x2, y2, xb1, yb1) +
                       dis(xa2, ya2, xb1, yb1));
  res1 = min(res1, dis(x1, y1, xa1, ya1) + dis(x2, y2, xb2, yb2) +
                       dis(xa1, ya1, xb2, yb2));
  res1 = min(res1, dis(x1, y1, xa2, ya2) + dis(x2, y2, xb2, yb2) +
                       dis(xa2, ya2, xb2, yb2));
  cout << fixed << setprecision(15) << res1;
}
