#include <bits/stdc++.h>
using namespace std;
long double EPS = 1e-8;
const long long NMAX = 211111;
const long long inf = 1e9;
const long long M = 1e9 + 33;
signed main() {
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(40);
  long double a, b, c;
  cin >> a >> b >> c;
  long double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long double ans = abs(x1 - x2) + abs(y1 - y2);
  long double xa, ya;
  xa = x1;
  ya = -(c + a * xa) / b;
  long double xb, yb;
  yb = y1;
  xb = -(c + b * yb) / a;
  long double xc, yc;
  xc = x2;
  yc = -(c + a * xc) / b;
  long double xd, yd;
  yd = y2;
  xd = -(c + b * yd) / a;
  ans = min(ans, fabs(y1 - ya) + fabs(y2 - yc) +
                     sqrt((xa - xc) * (xa - xc) + (ya - yc) * (ya - yc)));
  ans = min(ans, fabs(x1 - xb) + fabs(x2 - xd) +
                     sqrt((xd - xb) * (xd - xb) + (yb - yd) * (yb - yd)));
  ans = min(ans, fabs(x1 - xb) + fabs(y2 - yc) +
                     sqrt((xb - xc) * (xb - xc) + (yb - yc) * (yb - yc)));
  ans = min(ans, fabs(y1 - ya) + fabs(x2 - xd) +
                     sqrt((xa - xd) * (xa - xd) + (ya - yd) * (ya - yd)));
  cout << ans;
  return 0;
}
