#include <bits/stdc++.h>
using namespace std;
long double a, b, c;
long double x1, sldjgsd, x2, y2;
long double x11, y11, x12, y12;
long double x21, y21, x22, y22;
long double c1, c2, c3, c4;
long double dis(long double X1, long double Y1, long double X2,
                long double Y2) {
  return sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b >> c;
  cin >> x1 >> sldjgsd >> x2 >> y2;
  if (a == 0 or b == 0) {
    cout << setprecision(10) << fixed << abs(x1 - x2) + abs(sldjgsd - y2)
         << endl;
    return 0;
  }
  x11 = x1, y11 = (a * x1 + c) / -b;
  x12 = (b * sldjgsd + c) / -a, y12 = sldjgsd;
  x21 = x2, y21 = (a * x2 + c) / -b;
  x22 = (b * y2 + c) / -a, y22 = y2;
  c1 = dis(x11, y11, x1, sldjgsd) + dis(x21, y21, x2, y2) +
       dis(x11, y11, x21, y21);
  c2 = dis(x12, y12, x1, sldjgsd) + dis(x21, y21, x2, y2) +
       dis(x12, y12, x21, y21);
  c3 = dis(x11, y11, x1, sldjgsd) + dis(x22, y22, x2, y2) +
       dis(x11, y11, x22, y22);
  c4 = dis(x12, y12, x1, sldjgsd) + dis(x22, y22, x2, y2) +
       dis(x12, y12, x22, y22);
  cout << setprecision(10) << fixed
       << min(min(min(c1, c2), min(c3, c4)), abs(x1 - x2) + abs(sldjgsd - y2))
       << endl;
  return 0;
}
