#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0);
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";
template <class T>
ostream &operator<<(ostream &out, vector<T> &a) {
  out << "{";
  for (auto x : a) out << x << " ";
  return out << "}";
}
void smain();
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(12) << fixed;
  smain();
}
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  return sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
void solve2() {
  long long a, b, c;
  cin >> a >> b >> c;
  long long x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  if (a == 0 || b == 0) {
    cout << abs(x1 - x2) + abs(y1 - y2);
    return;
  }
  long long lx = x1, rx = x2;
  if (lx > rx) swap(lx, rx);
  long long ly = y2, ry = y1;
  if (ly > ry) swap(ly, ry);
  long double f = (long double)(-a * x1 - c) / b;
  long double s = (long double)(-b * y2 - c) / a;
  long double ans = abs(x1 - x2) + abs(y1 - y2);
  long double cur = abs(f - y1) + abs(x2 - s) + dist(x1, f, s, y2);
  ans = min(ans, (cur));
  s = (long double)(-a * x2 - c) / b;
  cur = abs(f - y1) + abs(y2 - s) + dist(x1, f, x2, s);
  ans = min(ans, (cur));
  f = (long double)(-b * y1 - c) / a;
  cur = abs(f - x1) + abs(y2 - s) + dist(f, y1, x2, s);
  ans = min(ans, (cur));
  s = (long double)(-b * y2 - c) / a;
  cur = abs(f - x1) + abs(x2 - s) + dist(f, y1, s, y2);
  ans = min(ans, (cur));
  cout << ans;
}
void smain() { solve2(); }
