#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int MAX = 2e5 + 10;
const long long mod = 1e9;
const double eps = 1e-6;
const double pi = acos(-1);
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int sign(double k) {
  if (k > eps)
    return 1;
  else if (k < -eps)
    return -1;
  return 0;
}
int cmp(double k1, double k2) { return sign(k1 - k2); }
int main() {
  cout << setiosflags(ios::fixed);
  cout.precision(10);
  double a, b, c;
  double x1, y1, x2, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  if ((x2 * a + y1 * b + c) * (x1 * a + y2 * b + c) >= 0 ||
      a * b * (x1 - x2) * (y1 - y2) > 0 || a == 0 || b == 0) {
    cout << abs(x1 - x2) + abs(y1 - y2);
    return 0;
  }
  long long px = 0, py = 0;
  double ansx[2];
  double ansy[2];
  double x3 = (-c - b * y1) / a;
  double x4 = (-c - b * y2) / a;
  double y3 = (-c - a * x1) / b;
  double y4 = (-c - a * x2) / b;
  int xx, yy;
  if (cmp(x3, max(x1, x2)) != 1 && cmp(x3, min(x1, x2)) != -1) {
    yy = 1;
    ansx[px] = x3;
    px++;
  }
  if (cmp(x4, max(x1, x2)) != 1 && cmp(x4, min(x1, x2)) != -1) {
    yy = 2;
    ansx[px] = x4;
    px++;
  }
  if (cmp(y3, max(y1, y2)) != 1 && cmp(y3, min(y1, y2)) != -1) {
    xx = 1;
    ansy[py] = y3;
    py++;
  }
  if (cmp(y4, max(y1, y2)) != 1 && cmp(y4, min(y1, y2)) != -1) {
    xx = 2;
    ansy[py] = y4;
    py++;
  }
  double dx = max(x1, x2) - min(x1, x2);
  double dy = max(y1, y2) - min(y1, y2);
  if (px == 2) {
    cout << fixed << setprecision(10)
         << dx - abs(dy * b / a) + dy / abs(a) * sqrt(a * a + b * b);
    return 0;
  }
  if (py == 2) {
    cout << dy - abs(dx / b * a) + dx / abs(b) * sqrt(a * a + b * b);
    return 0;
  }
  if (py == 1 && px == 1) {
    double xxx[2];
    double xxx2[2];
    xxx[0] = x1;
    xxx[1] = x2;
    double yyy[2];
    double yyy2[2];
    yyy[0] = y1;
    yyy[1] = y2;
    xxx2[0] = x3;
    xxx2[1] = x4;
    yyy2[0] = y3;
    yyy2[1] = y4;
    double q = yyy2[xx - 1] - yyy[yy - 1];
    double w = xxx[xx - 1] - xxx2[yy - 1];
    cout << fixed << setprecision(10)
         << dx + dy - abs(q) - abs(w) + sqrt(q * q + w * w);
  }
}
