#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
inline long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
inline long long power(long long a, long long n, long long m) {
  if (n == 0) return 1;
  long long p = power(a, n / 2, m);
  p = (p * p) % m;
  if (n % 2)
    return (p * a) % m;
  else
    return p;
}
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const long long MOD = 1000000007;
int main() {
  long double a, b, c;
  long double inf = -10000000000000000.0;
  cin >> a >> b >> c;
  long double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  pair<long double, long double> p1[3];
  pair<long double, long double> p2[3];
  long double cost[3];
  long double cost2[3];
  cost[0] = 0;
  cost2[0] = 0;
  long double mn = 100000000000000.0;
  p1[0].first = x1;
  p1[0].second = y1;
  p2[0].first = x2;
  p2[0].second = y2;
  long double vl;
  if (a != 0) {
    vl = -c;
    vl = vl - b * y1;
    vl = (long double)vl / a;
    p1[1].first = vl;
    p1[1].second = y1;
    cost[1] = abs(vl - x1);
  } else {
    p1[1].first = -10000000000000000.0;
    p2[1].second = -10000000000000000.0;
  }
  if (b != 0) {
    vl = -c;
    vl = vl - a * x1;
    vl = (long double)vl / b;
    p1[2].first = x1;
    p1[2].second = vl;
    cost[2] = abs(vl - y1);
  } else {
    p1[2].first = -10000000000000000.0;
    p1[2].second = -10000000000000000.0;
  }
  if (a != 0) {
    vl = -c;
    vl = vl - b * y2;
    vl = (long double)vl / a;
    p2[1].first = vl;
    p2[1].second = y2;
    cost2[1] = abs(vl - x2);
  } else {
    p2[1].first = -10000000000000000.0;
    p2[1].second = -10000000000000000.0;
  }
  if (b != 0) {
    vl = -c;
    vl = vl - a * x2;
    vl = (long double)vl / b;
    p2[2].first = x2;
    p2[2].second = vl;
    cost2[2] = abs(vl - y2);
  } else {
    p2[2].first = -10000000000000000.0;
    p2[2].second = -10000000000000000.0;
  }
  mn = min(mn,
           abs(p1[0].first - p2[0].first) + abs(p1[0].second - p2[0].second));
  long double ans;
  for (int i = 1; i <= 2; i++) {
    for (int j = 1; j <= 2; j++) {
      if (p1[i].first != inf && p1[j].first != inf) {
        ans = cost[i] + cost2[j];
        x1 = abs(p1[i].first - p2[j].first);
        y1 = abs(p1[i].second - p2[j].second);
        x1 = x1 * x1;
        y1 = y1 * y1;
        x1 = sqrt(x1 + y1);
        mn = min(mn, ans + x1);
      }
    }
  }
  cout << setprecision(20);
  cout << mn << endl;
  return 0;
}
