#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int C = 26;
void add(int &x, int y) {
  x += y;
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
}
int fix(int x) {
  while (x >= MOD) x -= MOD;
  while (x < 0) x += MOD;
  return x;
}
int pw(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % MOD;
    b >>= 1;
    a = 1ll * a * a % MOD;
  }
  return ret;
}
const int MAXN = 1e6 + 10;
long long a, b, c, x[2], y[2];
long double sq(long double xx) { return xx * xx; }
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  return sqrt(sq(x1 - x2) + sq(y1 - y2));
}
void solve() {
  cin >> a >> b >> c;
  for (int i = 0; i < 2; i++) {
    cin >> x[i] >> y[i];
  }
  if (x[0] == x[1]) {
    cout << abs(y[0] - y[1]) << "\n";
    return;
  }
  if (y[0] == y[1]) {
    cout << abs(x[0] - x[1]) << "\n";
    return;
  }
  if (a == 0 || b == 0) {
    cout << abs(x[0] - x[1]) + abs(y[0] - y[1]) << "\n";
    return;
  }
  long double ans = abs(x[0] - x[1]) + abs(y[0] - y[1]);
  vector<pair<long double, long double>> A, B;
  A.emplace_back(x[0], 1. / b * (-a * x[0] - c));
  A.emplace_back(1. / a * (-b * y[0] - c), y[0]);
  B.emplace_back(x[1], 1. / b * (-a * x[1] - c));
  B.emplace_back(1. / a * (-b * y[1] - c), y[1]);
  for (auto [x1, y1] : A) {
    for (auto [x2, y2] : B) {
      ans = min(ans, fabs(x[0] - x1) + fabs(y[0] - y1) + dist(x1, y1, x2, y2) +
                         fabs(x2 - x[1]) + fabs(y2 - y[1]));
    }
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(9);
  int te = 1;
  for (int w = 1; w <= te; w++) {
    solve();
  }
  return 0;
}
