#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long double a, b, c;
  cin >> a >> b >> c;
  long double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long double ret = abs(x1 - x2) + abs(y1 - y2);
  if (b != 0 && a != 0) {
    long double cx1 = -(c + b * y1) / a;
    long double cx2 = -(c + b * y2) / a;
    long double cy1 = -(c + a * x1) / b;
    long double cy2 = -(c + a * x2) / b;
    ret = min(ret, abs(cx1 - x1) + hypot(cx1 - x2, y1 - cy2) + abs(cy2 - y2));
    ret = min(ret, abs(cx1 - x1) + hypot(cx1 - cx2, y2 - y1) + abs(cx2 - x2));
    ret = min(ret, abs(cy1 - y1) + hypot(cy1 - cy2, x1 - x2) + abs(cy2 - y2));
    ret = min(ret, abs(cy1 - y1) + hypot(cy1 - y2, x1 - cx2) + abs(cx2 - x2));
  }
  (cout << fixed).precision(18);
  cout << ret << endl;
  return 0;
}
