#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
inline long long bigmod(long long b, long long p, long long m) {
  long long ret = 1, cur = b % m;
  while (p) {
    if (p & 1) ret = (ret * cur) % m;
    cur = (cur * cur) % m;
    p = p >> 1;
  }
  return ret;
}
long long a, b, c;
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  void take_input() { cin >> x >> y; }
  void show() { printf("%.5f %.5f\n", x, y); }
};
point p, q;
double get_x(long long y, bool &flag) {
  if (a == 0) {
    flag = false;
    return 0;
  }
  flag = true;
  return (-c - (double)b * y) / (double)a;
}
double get_y(long long x, bool &flag) {
  if (b == 0) {
    flag = false;
    return 0;
  }
  flag = true;
  return (-c - (double)a * x) / (double)b;
}
double distance(point p1, point p2) {
  return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
double solve() {
  double ret = fabs(p.x - q.x) + fabs(p.y - q.y);
  point mid1, mid2;
  bool f1, f2;
  mid1 = point(p.x, get_y(p.x, f1));
  mid2 = point(q.x, get_y(q.x, f2));
  if (f1 && f2)
    ret =
        min(ret, distance(p, mid1) + distance(mid1, mid2) + distance(mid2, q));
  mid1 = point(p.x, get_y(p.x, f1));
  mid2 = point(get_x(q.y, f2), q.y);
  if (f1 && f2)
    ret =
        min(ret, distance(p, mid1) + distance(mid1, mid2) + distance(mid2, q));
  mid1 = point(get_x(p.y, f1), p.y);
  mid2 = point(q.x, get_y(q.x, f2));
  if (f1 && f2)
    ret =
        min(ret, distance(p, mid1) + distance(mid1, mid2) + distance(mid2, q));
  mid1 = point(get_x(p.y, f1), p.y);
  mid2 = point(get_x(q.y, f2), q.y);
  if (f1 && f2)
    ret =
        min(ret, distance(p, mid1) + distance(mid1, mid2) + distance(mid2, q));
  return ret;
}
int main() {
  scanf("%lld %lld %lld", &a, &b, &c);
  p.take_input();
  q.take_input();
  double ret = solve();
  printf("%.10f\n", ret);
  return 0;
}
