#include <bits/stdc++.h>
using namespace std;
void acceleration() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  acceleration();
  double ax, ay, bx, by, a, b, c;
  cin >> a >> b >> c >> ax >> ay >> bx >> by;
  double ans = abs(ax - bx) + abs(ay - by);
  double y1 = -(a * ax + c) / b, x1 = -(b * ay + c) / a;
  double r1 = abs(ax - x1), r2 = abs(ay - y1);
  double y2 = -(a * bx + c) / b, x2 = -(b * by + c) / a;
  double r3 = abs(bx - x2), r4 = abs(by - y2);
  double s1 = sqrtl((ax - bx) * (ax - bx) + (y1 - y2) * (y1 - y2));
  double s2 = sqrtl((ax - x2) * (ax - x2) + (y1 - by) * (y1 - by));
  double s3 = sqrtl((x1 - bx) * (x1 - bx) + (ay - y2) * (ay - y2));
  double s4 = sqrtl((x1 - x2) * (x1 - x2) + (ay - by) * (ay - by));
  double p1 = r2 + s1 + r4;
  double p2 = r2 + s2 + r3;
  double p3 = r1 + s3 + r4;
  double p4 = r1 + s4 + r3;
  ans = min(ans, min(p1, min(p2, min(p3, p4))));
  cout << fixed << setprecision(15) << ans << endl;
}
