#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<pair<int, int> > VPII;
typedef vector<long long> VLL;
constexpr char nl = '\n';
template <class t, class u>
inline void mini(t& a, u&& b) {
  if (b < a) a = b;
}
template <class t, class u>
inline void maxi(t& a, u&& b) {
  if (b > a) a = b;
}
int ceil2(int h) {
  return h < 2 ? 1 : 1 << (sizeof(h) * 8 - __builtin_clz(h - 1));
}
template <class t>
struct Dump {
  t a, b;
};
template <class t>
auto dump(t&& h) -> Dump<decltype(begin(h))> {
  return {begin(h), end(h)};
}
template <class t>
auto stub(t* h) -> decltype(cerr << *h, 0);
template <class t>
char stub(...);
struct debug {
  operator int() { return 0; }
  template <class t>
  debug& operator<<(t&&) {
    return *this;
  }
};
const int N = (int)2e6 + 10;
float A, B, C;
float px, py, kx, ky;
float coef, coef2;
float jaka(float y) { return (-C - B * y) / A; }
float val(float x) { return (-C - A * x) / B; }
float kw(float x) { return x * x; }
float dis(float x, float y, float xx, float yy) {
  return sqrt(kw(x - xx) + kw(y - yy));
}
float calc(float x, float y, float xx, float yy) {
  float res = dis(x, y, xx, yy) + abs(px - x) + abs(py - y) + abs(kx - xx) +
              abs(ky - yy);
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> A >> B >> C;
  cin >> px >> py >> kx >> ky;
  cout << setprecision(10) << fixed;
  if (B == 0) {
    cout << abs(px - kx) + abs(py - ky) << nl;
    return 0;
  }
  if (px == kx || py == ky) {
    cout << abs(px - kx) + abs(py - ky) << nl;
    return 0;
  }
  if (A == 0) {
    cout << abs(px - kx) + abs(py - ky) << nl;
    return 0;
  }
  float ans = abs(px - kx) + abs(py - ky);
  float x, xx, y, yy;
  x = px;
  y = val(px);
  xx = kx;
  yy = val(kx);
  ans = min(ans, calc(x, y, xx, yy));
  swap(x, xx);
  swap(y, yy);
  ans = min(ans, calc(x, y, xx, yy));
  x = jaka(py);
  y = py;
  xx = kx;
  yy = val(kx);
  ans = min(ans, calc(x, y, xx, yy));
  swap(x, xx);
  swap(y, yy);
  ans = min(ans, calc(x, y, xx, yy));
  x = jaka(py);
  y = py;
  xx = jaka(ky);
  yy = ky;
  ans = min(ans, calc(x, y, xx, yy));
  swap(x, xx);
  swap(y, yy);
  ans = min(ans, calc(x, y, xx, yy));
  x = px;
  y = val(px);
  xx = jaka(ky);
  yy = ky;
  ans = min(ans, calc(x, y, xx, yy));
  swap(x, xx);
  swap(y, yy);
  ans = min(ans, calc(x, y, xx, yy));
  cout << setprecision(10) << fixed;
  cout << ans << nl;
  return 0;
}
