// Arup Guha
// 11/3/2018
// Solution to 2018 SER D2 Problem: Goat Rope

import java.util.*;

public class goatrope {
	
	public static int[] goat;
	public static int[] left;
	public static int[] right;
	
	public static void main(String[] args) {
		
		// Read in goat center.
		Scanner stdin = new Scanner(System.in);
		goat = new int[2];
		for (int i=0; i<2; i++) goat[i] = stdin.nextInt();
		
		// Read in house.
		left = new int[2];
		for (int i=0; i<2; i++) left[i] = stdin.nextInt();
		right = new int[2];
		for (int i=0; i<2; i++) right[i] = stdin.nextInt();
		
		// Ta da!
		System.out.printf("%.3f\n", solve());
	}
	
	public static double solve( ) {
		
		// In range x.
		if (goat[0] >= left[0] && goat[0] <= right[0]) 
			return Math.min(Math.abs(left[1]-goat[1]), Math.abs(right[1]-goat[1]));
		
		// In range y.
		if (goat[1] >= left[1] && goat[1] <= right[1])
			return Math.min(Math.abs(left[0]-goat[0]), Math.abs(right[0]-goat[0]));
		
		// Other corners.
		int[] topleft = {left[0], right[1]};
		int[] botright = {left[1], right[0]};
		
		// If we get here, we are in a corner, just check all 4...
		double res = dist(goat, left);
		res = Math.min(res, dist(goat,right));
		res = Math.min(res, dist(goat,topleft));
		res = Math.min(res, dist(goat,botright));
		
		// This is the best.
		return res;
	}
	
	public static double dist(int[] a, int[] b) {
		return Math.sqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) );
	}
}
