#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long long MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, 1};
const int dy[] = {0, 0, 1, 1};
const int MAXN = (int)1e5 + 500;
const long long N = (long long)5001;
const int H = 20;
const double EPS = 1e-10;
const double PI = 3.14159265358979323846;
const int SZ = 550;
const long long INF = 1e9;
long long n, m, k;
string s, t;
pair<long long, long long> u, v;
double a, b, c;
bool in(double le, double ri, double p) {
  return p >= min(le, ri) && p <= max(le, ri);
}
double solve(pair<long long, long long> u, pair<long long, long long> v) {
  double ans = abs(u.first - v.first) + abs(u.second - v.second);
  cout.precision(10);
  if (a == 0 || b == 0) {
    return ans;
  }
  double x0 = -(b * u.second + c) / a;
  double oshfkfsldhs = -(a * v.first + c) / b;
  ans = min(ans, abs(u.first - x0) + abs(v.second - oshfkfsldhs) +
                     sqrt((x0 - v.first) * (x0 - v.first) +
                          (oshfkfsldhs - u.second) * (oshfkfsldhs - u.second)));
  double x1 = -(b * v.second + c) / a;
  double y0 = -(a * u.first + c) / b;
  ans = min(ans, abs(u.first - x0) + abs(v.first - x1) +
                     sqrt((x0 - x1) * (x0 - x1) +
                          (v.second - u.second) * (v.second - u.second)));
  ans = min(ans, abs(u.second - y0) + abs(v.second - oshfkfsldhs) +
                     sqrt((y0 - oshfkfsldhs) * (y0 - oshfkfsldhs) +
                          (v.first - u.first) * (v.first - u.first)));
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b >> c;
  cin >> u.first >> u.second >> v.first >> v.second;
  double ans = abs(u.first - v.first) + abs(u.second - v.second);
  cout.precision(10);
  cout << fixed << min(solve(u, v), solve(v, u));
}
