#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long sqr(long long x) { return x * x; }
long double sqrd(long double x) { return x * x; }
inline long long gcd(long long a, long long b) {
  while (b) {
    a %= b, swap(a, b);
  }
  return a;
}
inline long long lcm(long long a, long long b) {
  return a * b / max(1ll, gcd(a, b));
}
mt19937 Random((long long)time(0));
inline long long rnd(long long x) { return Random() % x; }
const long long INF = (long long)1e9 + 282;
const long long MOD = (long long)1e9 + 7;
const long double PI = acosl(-1.0);
long double getx(long double a, long double b, long double c, long double y) {
  return (-b * y - c) / a;
}
long double gety(long double a, long double b, long double c, long double x) {
  return (-a * x - c) / b;
}
long double getd(long double x1, long double y1, long double x2,
                 long double y2) {
  return sqrtl(sqrd(x1 - x2) + sqrd(y1 - y2));
}
long double getsd(long double x1, long double y1, long double x2,
                  long double y2, long double x3, long double y3,
                  long double x4, long double y4) {
  return getd(x1, y1, x2, y2) + getd(x2, y2, x3, y3) + getd(x3, y3, x4, y4);
}
void $main() {
  long long a, b, c;
  cin >> a >> b >> c;
  long long x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  if (!a || !b) {
    cout << (long double)(abs(x1 - x2) + abs(y1 - y2));
    return;
  }
  long double xx1 = getx(a, b, c, y1), yy1 = gety(a, b, c, x1),
              xx2 = getx(a, b, c, y2), yy2 = gety(a, b, c, x2);
  long double ans = abs(x1 - x2) + abs(y1 - y2);
  ans = min(ans, getsd(x1, y1, xx1, y1, xx2, y2, x2, y2));
  ans = min(ans, getsd(x1, y1, xx1, y1, x2, yy2, x2, y2));
  ans = min(ans, getsd(x1, y1, x1, yy1, xx2, y2, x2, y2));
  ans = min(ans, getsd(x1, y1, x1, yy1, x2, yy2, x2, y2));
  cout << ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios_base::fixed, ios_base::floatfield);
  cout.precision(12);
  $main();
}
