#include <bits/stdc++.h>
using namespace std;
long double a, b, c;
int main() {
  ios_base::sync_with_stdio(0);
  long double x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  long double wy = abs(x1 - x2) + abs(y1 - y2);
  long double c1x, c1y, c2x, c2y;
  int czy1 = 0, czy2 = 0;
  cout << fixed;
  cout.precision(15);
  if (a == 0 or b == 0 or x1 == x2 or y1 == y2) {
    cout << wy;
    return 0;
  }
  if (x2 > x1) {
    if ((-b * y1 - c) / a >= x1 and (-b * y1 - c) / a <= x2) {
      czy1 = 1;
      c1x = (-b * y1 - c) / a;
      c1y = y1;
    }
    if ((-b * y2 - c) / a >= x1 and (-b * y2 - c) / a <= x2) {
      czy2 = 1;
      c2x = (-b * y2 - c) / a;
      c2y = y2;
    }
  } else {
    if ((-b * y1 - c) / a <= x1 and (-b * y1 - c) / a >= x2) {
      czy1 = 1;
      c1x = (-b * y1 - c) / a;
      c1y = y1;
    }
    if ((-b * y2 - c) / a <= x1 and (-b * y2 - c) / a >= x2) {
      czy2 = 1;
      c2x = (-b * y2 - c) / a;
      c2y = y2;
    }
  }
  if (y2 > y1) {
    if ((-a * x1 - c) / b >= y1 and (-a * x1 - c) / b <= y2) {
      czy1 = 1;
      c1y = (-a * x1 - c) / b;
      c1x = x1;
    }
    if ((-a * x2 - c) / b >= y1 and (-a * x2 - c) / b <= y2) {
      czy2 = 1;
      c2y = (-a * x2 - c) / b;
      c2x = x2;
    }
  } else {
    if ((-a * x1 - c) / b <= y1 and (-a * x1 - c) / b >= y2) {
      czy1 = 1;
      c1y = (-a * x1 - c) / b;
      c1x = x1;
    }
    if ((-a * x2 - c) / b <= y1 and (-a * x2 - c) / b >= y2) {
      czy2 = 1;
      c2y = (-a * x2 - c) / b;
      c2x = x2;
    }
  }
  if (czy1 and czy2) {
    wy = min(wy,
             abs(x1 - c1x) + abs(x2 - c2x) + abs(y1 - c1y) + abs(y2 - c2y) +
                 sqrtl((c1x - c2x) * (c1x - c2x) + (c1y - c2y) * (c1y - c2y)));
  }
  cout << wy;
}
