#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pdd = pair<ld, ld>;
int __intend = 0;
void nextIntend() { __intend++; }
void prevIntend() { __intend--; }
string getIntend() {
  string r;
  for (int i = 0; i < __intend; ++i) {
    r += '\t';
  }
  return r;
}
template <typename T>
void print(const char s[], bool intend, T& v) {
  if (intend) cout << getIntend();
  cout << s << " = " << v << endl;
}
template <typename T, typename... TA>
void print(const char s[], bool intend, T& v, TA&... args) {
  if (intend) cout << getIntend();
  while (*s != ',') {
    if (*s != ' ') cout << *s;
    s++;
  }
  while (*s == ',' || *s == ' ') s++;
  cout << " = " << v << " | ";
  print(s, false, args...);
}
void solve() {
  ld a, b, c;
  cin >> a >> b >> c;
  ld x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  ld ans = abs(x1 - x2) + abs(y1 - y2);
  if (a && b) {
    ld tx1 = -(c + b * y1) / a;
    ld ty1 = -(c + a * x1) / b;
    ld tx2 = -(c + b * y2) / a;
    ld ty2 = -(c + a * x2) / b;
    ld dx = 0, dy = 0, d;
    dx = (tx1 - tx2);
    dy = (y1 - y2);
    d = sqrt(dx * dx + dy * dy);
    ans = min(ans, d + abs(x1 - tx1) + abs(x2 - tx2));
    dx = (tx1 - x2);
    dy = (y1 - ty2);
    d = sqrt(dx * dx + dy * dy);
    ans = min(ans, d + abs(x1 - tx1) + abs(y2 - ty2));
    dx = (x1 - tx2);
    dy = (ty1 - y2);
    d = sqrt(dx * dx + dy * dy);
    ans = min(ans, d + abs(ty1 - y1) + abs(x2 - tx2));
    dx = (x1 - x2);
    dy = (ty1 - ty2);
    d = sqrt(dx * dx + dy * dy);
    ans = min(ans, d + abs(ty1 - y1) + abs(y2 - ty2));
  }
  cout << fixed << setprecision(12) << ans;
}
const bool fastIO = false;
const bool withTest = false;
int main() {
  if (fastIO) {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
  }
  if (withTest) {
    int t;
    cin >> t;
    while (t--) solve();
  } else
    solve();
}
