#include <bits/stdc++.h>
using namespace std;
long double get_dist(long double x1, long double y1, long double x2,
                     long double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(16);
  long double a, b, c;
  cin >> a >> b >> c;
  long double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long double mini = abs(x2 - x1) + abs(y2 - y1);
  if (x1 == x2 || y1 == y2) {
    cout << mini << endl;
    return 0;
  }
  if (a == 0 || b == 0) {
    cout << mini << endl;
    return 0;
  }
  long double x3, x4, x5, x6, y3, y4, y5, y6;
  x3 = x1;
  y3 = (-c - a * x1) / b;
  x4 = (-c - b * y2) / a;
  y4 = y2;
  x5 = x2;
  y5 = (-c - a * x2) / b;
  x6 = (-c - b * y1) / a;
  y6 = y1;
  mini = min(mini, get_dist(x1, y1, x3, y3) + get_dist(x3, y3, x4, y4) +
                       get_dist(x4, y4, x2, y2));
  mini = min(mini, get_dist(x1, y1, x3, y3) + get_dist(x3, y3, x5, y5) +
                       get_dist(x5, y5, x2, y2));
  mini = min(mini, get_dist(x1, y1, x6, y6) + get_dist(x6, y6, x5, y5) +
                       get_dist(x5, y5, x2, y2));
  mini = min(mini, get_dist(x1, y1, x6, y6) + get_dist(x6, y6, x4, y4) +
                       get_dist(x4, y4, x2, y2));
  cout << mini << endl;
  return 0;
}
