#include <bits/stdc++.h>
using namespace std;
struct pt {
  double x, y;
  pt() {}
  pt(double a, double b) {
    x = a;
    y = b;
  }
};
double dist(pt a, pt b) {
  double xa = a.x - b.x;
  double yb = a.y - b.y;
  double dist = sqrt(xa * xa + yb * yb);
  return dist;
}
double get_ans1(pt a, pt b) {
  double res = fabs(a.x - b.x) + fabs(a.y - b.y);
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  double a, b, c;
  cin >> a >> b >> c;
  pt A, B;
  cin >> A.x >> A.y >> B.x >> B.y;
  cout << fixed;
  cout.precision(15);
  if (a == 0 || b == 0) {
    double ans = get_ans1(A, B);
    cout << ans;
    return 0;
  }
  double ans = get_ans1(A, B);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      double cur;
      if (i == 0 && j == 0) {
        pt PA = pt(A.x, (-A.x * a - c) / b);
        pt PB = pt(B.x, (-B.x * a - c) / b);
        cur = get_ans1(PA, A) + get_ans1(PB, B) + dist(PA, PB);
      }
      if (i == 0 && j == 1) {
        pt PA = pt(A.x, (-A.x * a - c) / b);
        pt PB = pt((-B.y * b - c) / a, B.y);
        cur = get_ans1(PA, A) + get_ans1(PB, B) + dist(PA, PB);
      }
      if (i == 1 && j == 0) {
        pt PA = pt((-A.y * b - c) / a, A.y);
        pt PB = pt(B.x, (-B.x * a - c) / b);
        cur = get_ans1(PA, A) + get_ans1(PB, B) + dist(PA, PB);
      }
      if (i == 1 && j == 1) {
        pt PA = pt((-A.y * b - c) / a, A.y);
        pt PB = pt((-B.y * b - c) / a, B.y);
        cur = get_ans1(PA, A) + get_ans1(PB, B) + dist(PA, PB);
      }
      ans = min(ans, cur);
    }
  }
  cout << ans;
  return 0;
}
