#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int sum, suf, pre, max;
} Node;
int toint(const string &s) {
  stringstream ss;
  ss << s;
  int x;
  ss >> x;
  return x;
}
const int MAXN = 2e5 + 100;
const int UP = 31;
const long long int highest = 1e18;
const double pi = acos(-1);
const double Phi = 1.618033988749894;
const int logn = 20;
const double root5 = 2.236067977;
const int INF = 1000000000;
const int ini = -1e9;
const int N = 1e5 + 10;
double inf = 1e9;
double a, b, c, x1, y11, x2, y2;
double sqr(double x) { return x * x; }
double dist(double x1, double y11, double x2, double y2) {
  return (sqrt(sqr(x1 - x2) + sqr(y11 - y2)));
}
pair<double, double> getx(double x) { return make_pair(x, (-a * x - c) / b); }
pair<double, double> gety(double y) { return make_pair((-b * y - c) / a, y); }
int main() {
  cin >> a >> b >> c;
  cin >> x1 >> y11;
  cin >> x2 >> y2;
  double ans = (abs(x1 - x2) + abs(y11 - y2));
  std::vector<pair<double, double> > v1;
  std::vector<pair<double, double> > v2;
  v1.push_back(getx(x1));
  v1.push_back(gety(y11));
  v2.push_back(getx(x2));
  v2.push_back(gety(y2));
  for (auto i : v1) {
    for (auto j : v2) {
      double dd = dist(x1, y11, i.first, i.second) +
                  dist(i.first, i.second, j.first, j.second) +
                  dist(j.first, j.second, x2, y2);
      ans = min(ans, dd);
    }
  }
  printf("%.10lf\n", ans);
  return 0;
}
