#include <bits/stdc++.h>
using namespace std;
const long long INF = 200000000 + 1;
const int N = 300006, M = 80;
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  long double d1 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  d1 = sqrt(d1);
  return d1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(9);
  long double a, b, c;
  long double x1, x2, y1, y2;
  cin >> a >> b >> c >> x1 >> y1 >> x2 >> y2;
  if (a == 0 || b == 0) {
    cout << abs(x1 - x2) + abs(y1 - y2) << '\n';
    return 0;
  }
  long double ans = abs(x1 - x2) + abs(y1 - y2);
  long double p1 = -(c + a * x1) / (long double)b;
  long double p2 = -(c + b * y1) / (long double)a;
  long double p3 = -(c + a * x2) / (long double)b;
  long double p4 = -(c + b * y2) / (long double)a;
  long double dist1 = abs(p1 - y1) + dist(x1, p1, x2, p3) + abs(p3 - y2);
  long double dist2 = abs(p1 - y1) + dist(x1, p1, p4, y2) + abs(p4 - x2);
  long double dist3 = abs(p2 - x1) + dist(p2, y1, x2, p3) + abs(p3 - y2);
  long double dist4 = abs(p2 - x1) + dist(p2, y1, p4, y2) + abs(p4 - x2);
  cout << min(dist1, min(dist2, min(dist3, min(dist4, ans)))) << '\n';
}
