#include <bits/stdc++.h>
using namespace std;
long long mod(long long x) {
  if (x >= 1000000007)
    return x - 1000000007;
  else
    return x;
}
long long binpow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 1)
    return (binpow(a, n - 1) * a);
  else {
    long long b = (binpow(a, n / 2));
    return (b * b);
  }
}
struct point {
  long double x, y;
};
struct otr {
  point s, f;
};
struct line {
  long double a, b, c;
};
vector<long long> t;
void build(vector<long long> a, int v, int tl, int tr) {
  if (tl == tr)
    t[v] = a[tl];
  else {
    int tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm);
    build(a, v * 2 + 1, tm + 1, tr);
    t[v] = t[v * 2] + t[v * 2 + 1];
  }
}
long long sum(int v, int tl, int tr, int l, int r) {
  if (l > r) return 0;
  if (l == tl && r == tr) return t[v];
  int tm = (tl + tr) / 2;
  return sum(v * 2, tl, tm, l, min(r, tm)) +
         sum(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
}
void update(int v, int tl, int tr, int pos, int new_val) {
  if (tl == tr)
    t[v] = new_val;
  else {
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, new_val);
    else
      update(v * 2 + 1, tm + 1, tr, pos, new_val);
    t[v] = t[v * 2] + t[v * 2 + 1];
  }
}
const double EPS = 1e-9;
double det(double a, double b, double c, double d) { return a * d - b * c; }
bool intersect(line m, line n, point &res) {
  long double zn = det(m.a, m.b, n.a, n.b);
  if (abs(zn) < EPS) return false;
  res.x = -det(m.c, m.b, n.c, n.b) / zn;
  res.y = -det(m.a, m.c, n.a, n.c) / zn;
  return true;
}
struct fruct {
  int x, y, k;
};
long double rast(point aa, point bb) {
  return sqrt((aa.x - bb.x) * (aa.x - bb.x) + (aa.y - bb.y) * (aa.y - bb.y));
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long double a, b, c;
  cin >> a >> b >> c;
  point A, B;
  cin >> A.x >> A.y >> B.x >> B.y;
  line main_line = {a, b, c}, A_line_x = {1, 0, -A.x}, A_line_y = {0, 1, -A.y},
       B_line_x = {1, 0, -B.x}, B_line_y = {0, 1, -B.y};
  long double AtoB = abs(A.x - B.x) + abs(A.y - B.y);
  point A_main_line, B_main_line;
  long double A_to_d = 1000000000, B_to_d = 1000000000;
  point s_on_d, f_on_d;
  long double A_to_d2 = 1000000000, B_to_d2 = 1000000000;
  point s_on_d2, f_on_d2;
  if (intersect(main_line, A_line_x, A_main_line)) {
    A_to_d = abs(A_main_line.y - A.y);
    s_on_d.x = A_main_line.x;
    s_on_d.y = A_main_line.y;
  }
  if (intersect(main_line, A_line_y, A_main_line)) {
    A_to_d2 = abs(A_main_line.x - A.x);
    s_on_d2.x = A_main_line.x;
    s_on_d2.y = A_main_line.y;
  }
  if (intersect(main_line, B_line_x, B_main_line)) {
    B_to_d = abs(B_main_line.y - B.y);
    f_on_d.x = B_main_line.x;
    f_on_d.y = B_main_line.y;
  }
  if (intersect(main_line, B_line_y, B_main_line)) {
    B_to_d2 = abs(B_main_line.x - B.x);
    f_on_d2.x = B_main_line.x;
    f_on_d2.y = B_main_line.y;
  }
  long double ans = min(AtoB, (A_to_d + B_to_d + rast(s_on_d, f_on_d)));
  ans = min(ans, (A_to_d2 + B_to_d + rast(s_on_d2, f_on_d)));
  ans = min(ans, (A_to_d + B_to_d2 + rast(s_on_d, f_on_d2)));
  ans = min(ans, (A_to_d2 + B_to_d2 + rast(s_on_d2, f_on_d2)));
  cout << setprecision(20) << ans;
  return 0;
}
