#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005, maxv = 4e6 + 5;
long long a, b, c, X1, X2, Y1, Y2;
pair<long double, long double> va[6], vb[6];
void exgcd(long long a, long long b, long long &x, long long &y) {
  if (!b) {
    x = 1, y = 0;
    return;
  }
  exgcd(b, a % b, y, x);
  y -= a / b * x;
}
long double sqr(long double x) { return x * x; }
int main() {
  scanf("%lld %lld %lld", &a, &b, &c);
  scanf("%lld %lld %lld %lld", &X1, &Y1, &X2, &Y2);
  long double ans = abs(X1 - X2) + abs(Y1 - Y2);
  if (a != 0 && b != 0) {
    va[0] = make_pair(X1, (long double)(-c - a * X1) / b);
    va[1] = make_pair((long double)(-c - b * Y1) / a, Y1);
    vb[0] = make_pair(X2, (long double)(-c - a * X2) / b);
    vb[1] = make_pair((long double)(-c - b * Y2) / a, Y2);
    for (int i = 0; i <= 1; i++)
      for (int j = 0; j <= 1; j++) {
        long double ans1 = fabs(X1 - va[i].first) + fabs(Y1 - va[i].second) +
                           fabs(X2 - vb[j].first) + fabs(Y2 - vb[j].second);
        ans1 += sqrt(sqr(va[i].first - vb[j].first) +
                     sqr(va[i].second - vb[j].second));
        ans = min(ans, ans1);
      }
  }
  printf("%.9f\n", (double)ans);
}
