#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y;
} T1, T2;
double A, B, C;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cout << fixed << setprecision(7);
  cin >> A >> B >> C;
  cin >> T1.x >> T1.y >> T2.x >> T2.y;
  double peresx1 = 1e9, peresx2 = 1e9, peresy1 = 1e9, peresy2 = 1e9;
  if (A != 0) peresx1 = (-C - B * T1.y) / A;
  if (B != 0) peresy1 = (-C - A * T1.x) / B;
  if (A != 0) peresx2 = (-C - B * T2.y) / A;
  if (B != 0) peresy2 = (-C - A * T2.x) / B;
  double ans = abs(T1.x - T2.x) + abs(T1.y - T2.y);
  double min1x, min1y, min2x, min2y;
  double ans1 = abs(peresx1 - T1.x) +
                sqrt((peresx1 - peresx2) * (peresx1 - peresx2) +
                     (T1.y - T2.y) * (T1.y - T2.y)) +
                abs(peresx2 - T2.x);
  double ans2 = abs(peresx1 - T1.x) +
                sqrt((peresx1 - T2.x) * (peresx1 - T2.x) +
                     (T1.y - peresy2) * (T1.y - peresy2)) +
                abs(T2.y - peresy2);
  double ans3 = abs(peresy1 - T1.y) +
                sqrt((T1.x - T2.x) * (T1.x - T2.x) +
                     (peresy1 - peresy2) * (peresy1 - peresy2)) +
                abs(T2.y - peresy2);
  double ans4 = abs(peresy1 - T1.y) +
                sqrt((T1.x - peresx2) * (T1.x - peresx2) +
                     (peresy1 - T2.y) * (peresy1 - T2.y)) +
                abs(T2.x - peresx2);
  ans = min(ans, min(min(ans1, ans2), min(ans3, ans4)));
  cout << ans << '\n';
  return 0;
}
