#include <bits/stdc++.h>
using namespace std;
void io() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
const int MAXN = 5e5 + 5;
const long long INF = 0x3f3f3f3f3f3f3f;
const long long MOD = 1e9 + 7;
struct Point {
  double x, y;
  Point(double _x = 0, double _y = 0) : x(_x), y(_y) {}
  Point operator+(const Point& p) { return Point(x + p.x, y + p.y); }
  Point operator-(const Point& p) { return Point(x - p.x, y - p.y); }
  double length() { return sqrt(x * x + y * y); }
} p1, p2;
double a, b, c;
double cross(const Point& a, const Point& b) { return a.x * b.y - b.x * a.y; }
int main() {
  io();
  cin >> a >> b >> c;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  Point p1x(p1.x, -(a * p1.x + c) / b);
  Point p1y(-(b * p1.y + c) / a, p1.y);
  Point p2x(p2.x, -(a * p2.x + c) / b);
  Point p2y(-(b * p2.y + c) / a, p2.y);
  double ans = abs(p1.x - p2.x) + abs(p1.y - p2.y);
  ans = min(ans,
            (p1x - p1).length() + (p2x - p2).length() + (p1x - p2x).length());
  ans = min(ans,
            (p1x - p1).length() + (p2y - p2).length() + (p1x - p2y).length());
  ans = min(ans,
            (p1y - p1).length() + (p2x - p2).length() + (p1y - p2x).length());
  ans = min(ans,
            (p1y - p1).length() + (p2y - p2).length() + (p1y - p2y).length());
  printf("%.10lf\n", ans);
}
