#include <bits/stdc++.h>
const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
using namespace std;
using ld = long double;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ld a, b, c;
  cin >> a >> b >> c;
  ld sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  ld ans = abs(sx - tx) + abs(sy - ty);
  ld tmpx1, tmpy1, tmpx2, tmpy2;
  tmpx1 = (-c - b * sy) / a;
  tmpx2 = (-c - b * ty) / a;
  tmpy1 = (-c - a * sx) / b;
  tmpy2 = (-c - a * tx) / b;
  ans = min(
      ans, abs(sx - tmpx1) + abs(tx - tmpx2) +
               sqrt((tmpx1 - tmpx2) * (tmpx1 - tmpx2) + (sy - ty) * (sy - ty)));
  ans = min(
      ans, abs(sx - tmpx1) + abs(ty - tmpy2) +
               sqrt((tmpx1 - tx) * (tmpx1 - tx) + (sy - tmpy2) * (sy - tmpy2)));
  ans = min(
      ans, abs(sy - tmpy1) + abs(tx - tmpx2) +
               sqrt((sx - tmpx2) * (sx - tmpx2) + (tmpy1 - ty) * (tmpy1 - ty)));
  ans = min(
      ans, abs(sy - tmpy1) + abs(ty - tmpy2) +
               sqrt((sx - tx) * (sx - tx) + (tmpy1 - tmpy2) * (tmpy1 - tmpy2)));
  cout << fixed << setprecision(12) << ans << endl;
}
