#include <bits/stdc++.h>
using namespace std;
long double dist(long double x, long double y, long double a, long double b) {
  return sqrt((a - x) * (a - x) + (y - b) * (y - b));
}
long double distMan(long double x, long double y, long double a,
                    long double b) {
  return abs(x - a) + abs(y - b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tt = 1;
  while (tt--) {
    long double a, b, c;
    cin >> a >> b >> c;
    long double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (a == 0 || b == 0) {
      cout << ' ' << fixed << setprecision(20) << ' '
           << abs(x1 - x2) + abs(y1 - y2) << '\n';
    } else {
      long double ans = abs(x2 - x1) + abs(y2 - y1);
      long double x3, y3, x4, y4;
      x3 = x1, x4 = x2;
      y3 = (-a * x3 - c) / b, y4 = (-a * x4 - c) / b;
      ans = min(ans, distMan(x1, y1, x3, y3) + distMan(x2, y2, x4, y4) +
                         dist(x4, y4, x3, y3));
      x3 = x1, y4 = y2;
      y3 = (-a * x3 - c) / b, x4 = (-b * y4 - c) / a;
      ans = min(ans, distMan(x1, y1, x3, y3) + distMan(x2, y2, x4, y4) +
                         dist(x4, y4, x3, y3));
      y3 = y1, x4 = x2;
      x3 = (-b * y3 - c) / a, y4 = (-a * x4 - c) / b;
      ans = min(ans, distMan(x1, y1, x3, y3) + distMan(x2, y2, x4, y4) +
                         dist(x4, y4, x3, y3));
      y3 = y1, y4 = y2;
      x3 = (-b * y3 - c) / a, x4 = (-b * y4 - c) / a;
      ans = min(ans, distMan(x1, y1, x3, y3) + distMan(x2, y2, x4, y4) +
                         dist(x4, y4, x3, y3));
      cout << ' ' << fixed << setprecision(20) << ' ' << ans << '\n';
    }
  }
}
