#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  double x01, y01, x02, y02;
  cin >> x01 >> y01 >> x02 >> y02;
  double a1 = 0;
  double b1 = 1;
  double c1 = -max(y01, y02);
  set<pair<double, double>> s;
  double x1 = (c * b1 - c1 * b) / (a1 * b - a * b1);
  if (min(x01, x02) <= x1 && x1 <= max(x01, x02)) s.insert({x1, -c1});
  a1 = 0;
  b1 = 1;
  c1 = -min(y01, y02);
  x1 = (c * b1 - c1 * b) / (a1 * b - a * b1);
  if (min(x01, x02) <= x1 && x1 <= max(x01, x02)) s.insert({x1, -c1});
  a1 = 1;
  b1 = 0;
  c1 = -min(x01, x02);
  double y1 = (a1 * c - a * c1) / (a * b1 - a1 * b);
  if (min(y01, y02) <= y1 && y1 <= max(y01, y02)) s.insert({-c1, y1});
  a1 = 1;
  b1 = 0;
  c1 = -max(x01, x02);
  y1 = (a1 * c - a * c1) / (a * b1 - a1 * b);
  if (min(y01, y02) <= y1 && y1 <= max(y01, y02)) s.insert({-c1, y1});
  double ans1 = 4e9 + 1;
  double ans2 = 0;
  if (s.size() == 2) {
    auto i = *(s.begin());
    x1 = i.first;
    y1 = i.second;
    s.erase(s.begin());
    i = *(s.begin());
    ans1 = 0;
    double x2 = i.first;
    double y2 = i.second;
    ans1 += sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    double p1 = sqrt((x01 - x2) * (x01 - x2) + (y01 - y2) * (y01 - y2));
    double p2 = sqrt((x1 - x01) * (x1 - x01) + (y1 - y01) * (y1 - y01));
    if ((x01 - x2) * (y01 - y2) == 0 && (x1 - x01) * (y1 - y01) == 0) {
      cout << abs(x02 - x01) + abs(y02 - y01);
      return 0;
    } else if ((x01 - x2) * (y01 - y2) == 0) {
      ans1 += p1 + sqrt((x1 - x02) * (x1 - x02) + (y1 - y02) * (y1 - y02));
    } else if ((x1 - x01) * (y1 - y01) == 0) {
      ans1 += p2 + sqrt((x02 - x2) * (x02 - x2) + (y02 - y2) * (y02 - y2));
    } else {
      cout << abs(x02 - x01) + abs(y02 - y01);
      return 0;
    }
  }
  ans2 += abs(x02 - x01) + abs(y02 - y01);
  cout << fixed << setprecision(9);
  cout << min(ans1, ans2);
  return 0;
}
