#include <bits/stdc++.h>
using namespace std;
long long add(long long aa, long long bb) {
  aa += bb;
  if (aa >= 1000000007) return aa - 1000000007;
  return aa;
}
long long mul(long long aa, long long bb) {
  aa *= bb;
  if (aa >= 1000000007) return aa % 1000000007;
  return aa;
}
long long power(long long aa, long long bb) {
  if (bb == 0) return 1;
  long long cc = power(aa, bb / 2);
  cc = mul(cc, cc);
  if (bb & 1) return mul(aa, cc);
  return cc;
}
long double a, b, c, x1, x2, qwerty, y2;
long double get1(long long x) {
  long double res = 1e20;
  if (b != 0) res = (a * x + c) / (-b);
  return res;
}
long double get2(long long y) {
  long double res = 1e20;
  if (a != 0) res = (b * y + c) / (-a);
  return res;
}
long double dist(long double aa, long double bb, long double cc,
                 long double dd) {
  return sqrt((aa - cc) * (aa - cc) + (bb - dd) * (bb - dd));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b >> c;
  cin >> x1 >> qwerty >> x2 >> y2;
  vector<pair<long double, long double> > v;
  v.push_back(make_pair(x1, get1(x1)));
  v.push_back(make_pair(x2, get1(x2)));
  v.push_back(make_pair(get2(qwerty), qwerty));
  v.push_back(make_pair(get2(y2), y2));
  long double ans = abs(x1 - x2) + abs(qwerty - y2);
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (i == j) continue;
      if ((abs(x1 - v[i].first) < 1e-9 || abs(qwerty - v[i].second) < 1e-9) &&
          (abs(x2 - v[j].first) < 1e-9 || abs(y2 - v[j].second) < 1e-9)) {
        long double di =
            dist(x1, qwerty, v[i].first, v[i].second) +
            dist(v[i].first, v[i].second, v[j].first, v[j].second) +
            dist(v[j].first, v[j].second, x2, y2);
        ans = min(ans, di);
      }
    }
  }
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}
