#include <bits/stdc++.h>
using namespace std;
using cd = complex<double>;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
long double a, b, c;
long double X(long long y) { return -(b * y + c) / a; }
long double Y(long long x) { return -(a * x + c) / b; }
long double dis1(long double sx, long double sy, long double nx,
                 long double ny) {
  return fabs(sx - nx) + abs(sy - ny);
}
long double dis2(long double sx, long double sy, long double nx,
                 long double ny) {
  return sqrt((sx - nx) * (sx - nx) + (sy - ny) * (sy - ny));
}
int main() {
  cin >> a >> b >> c;
  long double sx, sy, nx, ny;
  cin >> sx >> sy >> nx >> ny;
  long double ans = abs(sx - nx) + abs(sy - ny);
  if (a == 0 || b == 0) {
    printf("%.15Lf\n", ans);
    return 0;
  }
  vector<pair<long double, long double> > s, t;
  s.push_back({sx, Y(sx)});
  s.push_back({X(sy), sy});
  t.push_back({nx, Y(nx)});
  t.push_back({X(ny), ny});
  for (long long i = 0; i < 2; i++) {
    for (long long j = 0; j < 2; j++) {
      long double sum = 0;
      sum += dis1(sx, sy, s[i].first, s[i].second);
      sum += dis2(s[i].first, s[i].second, t[j].first, t[j].second);
      sum += dis1(t[j].first, t[j].second, nx, ny);
      ans = min(ans, sum);
    }
  }
  printf("%.15Lf\n", ans);
}
