#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  long long a, b, c;
  scanf("%lld%lld%lld", &a, &b, &c);
  long long x1, y1, x2, y2;
  scanf("%lld%lld%lld%lld", &x1, &y1, &x2, &y2);
  double ans = abs(x2 - x1) + abs(y2 - y1);
  if (a != 0 && b != 0) {
    double x3 = x1;
    double y3 = 1.0 * (-c - a * x1) / b;
    double y4 = y1;
    double x4 = 1.0 * (-c - b * y1) / a;
    double x5 = x2;
    double y5 = 1.0 * (-c - a * x2) / b;
    double y6 = y2;
    double x6 = 1.0 * (-c - b * y2) / a;
    ans = min(dist(x3, y3, x5, y5) + abs(y3 - y1) + abs(y5 - y2), ans);
    ans = min(dist(x4, y4, x5, y5) + abs(x4 - x1) + abs(y5 - y2), ans);
    ans = min(dist(x3, y3, x6, y6) + abs(y3 - y1) + abs(x6 - x2), ans);
    ans = min(dist(x4, y4, x6, y6) + abs(x4 - x1) + abs(x6 - x2), ans);
  } else if (a == 0 && b != 0) {
    ans = min(ans, dist(x1, -c / b, x2, -c / b) + abs(-c / b - y1) +
                       abs(-c / b - y2));
  } else if (a != 0 && b == 0) {
    ans = min(ans, dist(-c / a, y1, -c / a, y2) + abs(-c / a - x1) +
                       abs(-c / a - x2));
  }
  printf("%.10lf\n", ans);
  return 0;
}
