#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > point(4);
int sign(long long int x) {
  if (x > 0) return 1;
  if (x < 0) return -1;
  if (x == 0) return 0;
}
int check(long long int a, long long int b, long long int c) {
  int i;
  long long int tp;
  vector<int> side(4);
  for (i = 0; i < 4; i++)
    tp = (a * point[i].first + b * point[i].second + c), side[i] = sign(tp);
  if (side[0] > 0 & side[1] > 0 & side[2] > 0 & side[3] > 0) return 0;
  if (side[0] < 0 & side[1] < 0 & side[2] < 0 & side[3] < 0) return 0;
  return 1;
}
double dis(double w, double x, double y, double z) {
  double tp;
  double d;
  tp = ((w - y) * (w - y) + (x - z) * (x - z));
  d = sqrt(tp);
  return d;
}
int main() {
  long long int a, b, c, x1, x2, y1, y2;
  int f, k;
  cin >> a >> b >> c;
  double ans = (1e10);
  double p, q, temp, r;
  cout << setprecision(12) << fixed;
  f = 0;
  cin >> x1 >> y1 >> x2 >> y2;
  point[0] = {x1, y1};
  point[1] = {x2, y2};
  point[2] = {x1, y2};
  point[3] = {x2, y1};
  if (a == 0 || b == 0)
    f = 1;
  else {
    if (!check(a, b, c))
      f = 1;
    else {
      k = -1, k *= sign(a * b), k *= sign((y2 - y1) * (x2 - x1));
      if (k <= 0)
        f = 1;
      else {
        if (sign(a * x1 + b * y1 + c) * sign(a * x2 + b * y2 + c) >= 0) {
          p = -c - a * x1, p /= b, q = -c - b * y2, q /= a;
          temp = abs(y1 - p) + abs(x2 - q) + dis(x1, p, q, y2);
          ans = min(ans, temp);
          p = -c - a * x2, p /= b, q = -c - b * y1, q /= a;
          temp = abs(y2 - p) + abs(x1 - q) + dis(x2, p, q, y1);
          ans = min(ans, temp);
        } else {
          p = -c - b * y1, p /= a, q = -c - b * y2, q /= a;
          temp = abs(x1 - p) + abs(x2 - q) + dis(p, y1, q, y2);
          ans = min(ans, temp);
          p = -c - a * x1, p /= b, q = -c - a * x2, q /= b;
          temp = abs(y1 - p) + abs(y2 - q) + dis(x1, p, x2, q);
          ans = min(ans, temp);
        }
      }
    }
  }
  temp = 0;
  if (f) ans = abs(x1 - x2) + abs(y1 - y2);
  cout << ans << endl;
}
