#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
double eps = 0.0000001;
struct point {
  double x, y;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long a, b, c;
  cin >> a >> b >> c;
  cout << fixed << setprecision(8);
  point q, p;
  cin >> q.x >> q.y >> p.x >> p.y;
  double ans = fabs(q.x - p.x) + fabs(q.y - p.y);
  double res;
  if (a == 0 || b == 0) {
    cout << ans;
    return 0;
  }
  vector<point> w(4);
  w[0].x = q.x;
  w[0].y = -1. * (a * q.x + c) / b;
  w[1].y = q.y;
  w[1].x = -1. * (b * q.y + c) / a;
  w[2].x = p.x;
  w[2].y = -1. * (a * p.x + c) / b;
  w[3].y = p.y;
  w[3].x = -1. * (b * p.y + c) / a;
  for (int i = 0; i < 2; i++) {
    for (int j = 2; j < 4; j++) {
      res = fabs(q.x - w[i].x) + fabs(q.y - w[i].y);
      res += sqrt((w[i].x - w[j].x) * (w[i].x - w[j].x) +
                  (w[i].y - w[j].y) * (w[i].y - w[j].y));
      res += fabs(p.x - w[j].x) + fabs(p.y - w[j].y);
      ans = min(ans, res);
    }
  }
  cout << ans;
  return 0;
}
