#include <bits/stdc++.h>
using namespace std;
pair<long double, long double> p[5], q[5];
int main() {
  cout << fixed << setprecision(10);
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  int x1, y1, x2, y2;
  scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
  long double ans = fabsl(x1 - x2) + fabsl(y1 - y2);
  int r = 0, s = 0;
  if (b)
    p[++r] = pair<long double, long double>(
        (long double)x1, (-c - (long double)a * x1) / (long double)b);
  else if (((long long)a * x1 + c) == 0)
    p[++r] = pair<long double, long double>((long double)x1, (long double)y1);
  if (a)
    p[++r] = pair<long double, long double>(
        (-c - (long double)b * y1) / (long double)a, (long double)y1);
  else if (((long long)b * y1 + c) == 0)
    p[++r] = pair<long double, long double>((long double)x1, (long double)y1);
  if (b)
    q[++s] = pair<long double, long double>(
        (long double)x2, (-c - (long double)a * x2) / (long double)b);
  else if (((long long)a * x2 + c) == 0)
    q[++s] = pair<long double, long double>((long double)x2, (long double)y2);
  if (a)
    q[++s] = pair<long double, long double>(
        (-c - (long double)b * y2) / (long double)a, (long double)y2);
  else if (((long long)b * y2 + c) == 0)
    q[++s] = pair<long double, long double>((long double)x2, (long double)y2);
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= s; j++) {
      long double res = fabsl(p[i].first - x1) + fabsl(p[i].second - y1) +
                        fabsl(q[j].first - x2) + fabsl(q[j].second - y2);
      res += (long double)sqrtl(
          (p[i].first - q[j].first) * (p[i].first - q[j].first) +
          (p[i].second - q[j].second) * (p[i].second - q[j].second));
      if (ans > res + 1e-8) ans = res;
    }
  }
  cout << ans;
  return 0;
}
