#include <iostream>
#include <cmath>
using namespace std;
double dist(int x, int y) {
return sqrt(pow(x, 2) + pow(y, 2));
}
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int ax, ay, x1, y1, x2, y2;
double res;
cin >> ax >> ay >> x1 >> y1 >> x2 >> y2;
x1 -= ax;
x2 -= ax;
y1 -= ay;
y2 -= ay;
if (x2 < x1) swap(x1, x2);
if (y2 < y1) swap(y1, y2);
res = min(min(dist(x1, y1), dist(x1, y2)), min(dist(x2, y1), dist(x2, y2)));
if (x1 < 0 && x2 > 0) {
res = min(res, (double)min(abs(y1), abs(y2)));
}
if (y1 < 0 && y2 > 0) {
res = min(res, (double)min(abs(x1), abs(x2)));
}
printf("%.3f", res);
return 0;
}