#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, t1, t2, t3, t4, x1, y1, x2, y2, a, b, c;
  double buf1, buf2, buf3, buf4, buf5, ans, tempans;
  scanf("%lld %lld %lld %lld %lld %lld %lld", &a, &b, &c, &x1, &y1, &x2, &y2);
  ans = abs(x1 - x2) + abs(y1 - y2);
  if (a == 0) {
    buf1 = -c / (1.0 * a);
    tempans = abs(y1 - y2) + abs(x1 - buf1) + abs(x2 - buf1);
    ans = min(ans, tempans);
  } else if (b == 0) {
    buf1 = -c / (1.0 * b);
    tempans = abs(x1 - x2) + abs(y1 - buf1) + abs(y2 - buf1);
    ans = min(ans, tempans);
  } else {
    buf1 = x1;
    buf2 = (-a * x1) - c;
    buf2 /= (1.0 * b);
    tempans = abs(y1 - buf2);
    buf3 = x2;
    buf4 = (-a * x2) - c;
    buf4 /= (1.0 * b);
    tempans += abs(y2 - buf4);
    buf5 = (buf1 - buf3) * (buf1 - buf3) + (buf2 - buf4) * (buf2 - buf4);
    tempans += sqrtl(buf5);
    ans = min(ans, tempans);
    buf1 = x1;
    buf2 = (-a * x1) - c;
    buf2 /= (1.0 * b);
    tempans = abs(y1 - buf2);
    buf4 = y2;
    buf3 = (-b * y2) - c;
    buf3 /= (1.0 * a);
    tempans += abs(x2 - buf3);
    buf5 = (buf1 - buf3) * (buf1 - buf3) + (buf2 - buf4) * (buf2 - buf4);
    tempans += sqrtl(buf5);
    ans = min(ans, tempans);
    buf2 = y1;
    buf1 = (-b * y1) - c;
    buf1 /= (1.0 * a);
    tempans = abs(x1 - buf1);
    buf3 = x2;
    buf4 = (-a * x2) - c;
    buf4 /= (1.0 * b);
    tempans += abs(y2 - buf4);
    buf5 = (buf1 - buf3) * (buf1 - buf3) + (buf2 - buf4) * (buf2 - buf4);
    tempans += sqrtl(buf5);
    ans = min(ans, tempans);
    buf2 = y1;
    buf1 = (-b * y1) - c;
    buf1 /= (1.0 * a);
    tempans = abs(x1 - buf1);
    buf4 = y2;
    buf3 = (-b * y2) - c;
    buf3 /= (1.0 * a);
    tempans += abs(x2 - buf3);
    buf5 = (buf1 - buf3) * (buf1 - buf3) + (buf2 - buf4) * (buf2 - buf4);
    tempans += sqrtl(buf5);
    ans = min(ans, tempans);
  }
  printf("%.15lf\n", ans);
  return 0;
}
