#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(20);
  cout << fixed;
  cin.tie(0);
  cout.tie(0);
  ld a, b, c;
  cin >> a >> b >> c;
  ld x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  ld l1 = abs(x2 - x1) + abs(y2 - y1);
  ld y_forx1 = (-a * x1 - c) / b;
  ld y_forx2 = (-a * x2 - c) / b;
  ld x_fory1 = (-b * y1 - c) / a;
  ld x_fory2 = (-b * y2 - c) / a;
  ld l2 =
      abs(y1 - y_forx1) + hypot(x1 - x2, y_forx1 - y_forx2) + abs(y2 - y_forx2);
  ld l3 =
      abs(y1 - y_forx1) + hypot(x1 - x_fory2, y_forx1 - y2) + abs(x2 - x_fory2);
  ld l4 =
      abs(x1 - x_fory1) + hypot(x_fory1 - x_fory2, y1 - y2) + abs(x2 - x_fory2);
  ld l5 =
      abs(x1 - x_fory1) + hypot(x_fory1 - x2, y1 - y_forx2) + abs(y2 - y_forx2);
  cout << min(l1, min(l2, min(l3, min(l4, l5))));
}
