#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
struct point {
  double x, y;
  point() {}
  point(double a, double b) : x(a), y(b) {}
};
int a, b, c;
point getPointX(double x) {
  double y = -(a * x + c) / b;
  return point(x, y);
}
point getPointY(double y) {
  double x = -(b * y + c) / a;
  return point(x, y);
}
double dist(point a, point b) {
  double x = b.x - a.x;
  double y = b.y - a.y;
  return sqrt(x * x + y * y);
}
int main() {
  cin >> a >> b >> c;
  int x1, y1;
  int x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  point o = point(x1, y1);
  point o2 = point(x2, y2);
  double ans = fabs((double)x1 - x2) + fabs((double)y1 - y2);
  double tmp;
  point a, b;
  a = getPointX(x1);
  b = getPointX(x2);
  ans = min(ans, dist(o, a) + dist(a, b) + dist(b, o2));
  a = getPointX(x1);
  b = getPointY(y2);
  ans = min(ans, dist(o, a) + dist(a, b) + dist(b, o2));
  a = getPointY(y1);
  b = getPointX(x2);
  ans = min(ans, dist(o, a) + dist(a, b) + dist(b, o2));
  a = getPointY(y1);
  b = getPointY(y2);
  ans = min(ans, dist(o, a) + dist(a, b) + dist(b, o2));
  cout << setprecision(12) << ans << endl;
}
