#include <bits/stdc++.h>
using namespace std;
const int N = 10;
double a, b, c, ans;
double x[N], y[N];
double GetDis(int i, int j) { return fabs(x[i] - x[j]) + fabs(y[i] - y[j]); }
double GG(int i, int j) {
  return sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
}
int main() {
  scanf("%lf%lf%lf", &a, &b, &c);
  scanf("%lf%lf%lf%lf", &x[1], &y[1], &x[2], &y[2]);
  ans = GetDis(1, 2);
  x[3] = x[1];
  y[3] = -(a * x[1] + c) / b;
  x[4] = -(b * y[1] + c) / a;
  y[4] = y[1];
  x[5] = x[2];
  y[5] = -(a * x[2] + c) / b;
  x[6] = -(b * y[2] + c) / a;
  y[6] = y[2];
  ans = min(ans, GetDis(1, 3) + GG(3, 5) + GetDis(2, 5));
  ans = min(ans, GetDis(1, 3) + GG(3, 6) + GetDis(2, 6));
  ans = min(ans, GetDis(1, 4) + GG(4, 5) + GetDis(2, 5));
  ans = min(ans, GetDis(1, 4) + GG(4, 6) + GetDis(2, 6));
  printf("%.12lf\n", ans);
  return 0;
}
