#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = (long long)INF * INF;
int sgn(long long x) {
  if (x < 0) return -1;
  if (x == 0) return 0;
  return 1;
}
double euclidian(pair<double, double> p1, pair<double, double> p2) {
  return sqrt(pow(p2.first - p1.first, 2) + pow(p2.second - p1.second, 2));
}
double manhattan(pair<double, double> p1, pair<double, double> p2) {
  return abs(p2.first - p1.first) + abs(p2.second - p1.second);
}
long long X[2], Y[2];
int main() {
  cout << fixed << setprecision(10);
  long long a, b, c;
  cin >> a >> b >> c;
  for (int i = (0); i < (2); ++i) cin >> X[i] >> Y[i];
  double ans = abs(X[1] - X[0]) + abs(Y[1] - Y[0]);
  if (a == 0 || b == 0) {
    cout << ans;
    return 0;
  }
  vector<pair<double, double> > P[2];
  for (int i = (0); i < (2); ++i) {
    P[i].push_back(make_pair(X[i], -1.0 * (a * X[i] + c) / b));
    P[i].push_back(make_pair(-1.0 * (b * Y[i] + c) / a, Y[i]));
  }
  for (int i = (0); i < (2); ++i)
    for (int j = (0); j < (2); ++j)
      ans = min(ans, manhattan(make_pair(X[0], Y[0]), P[0][i]) +
                         euclidian(P[0][i], P[1][j]) +
                         manhattan(P[1][j], make_pair(X[1], Y[1])));
  cout << ans;
  return 0;
}
