#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
double z, p[2][2], prj[2][2][2];
double dist(double x1, double y1, double x2, double y2) {
  double dx = x1 - x2, dy = y1 - y2;
  return sqrt(dx * dx + dy * dy);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(15);
  cin >> a >> b >> c;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) cin >> p[i][j];
  z = abs(p[0][0] - p[1][0]) + abs(p[0][1] - p[1][1]);
  if (a && b) {
    double x1, y1;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) {
        if (j) {
          y1 = p[i][j];
          x1 = -(c + b * y1) / (1.0 * a);
        } else {
          x1 = p[i][j];
          y1 = -(c + a * x1) / (1.0 * b);
        }
        prj[i][j][0] = x1;
        prj[i][j][1] = y1;
      }
    double d, md1, md2;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j) {
        md1 = abs(p[0][0] - prj[0][i][0]) + abs(p[0][1] - prj[0][i][1]);
        md2 = abs(p[1][0] - prj[1][j][0]) + abs(p[1][1] - prj[1][j][1]);
        d = dist(prj[0][i][0], prj[0][i][1], prj[1][j][0], prj[1][j][1]);
        z = min(z, md1 + d + md2);
      }
  }
  cout << z << "\n";
  return 0;
}
