#include <iostream>
#include <math.h>

using namespace std;

int main(){
	double p,t,g1,g2,g3,gj,score;
	cin >> p >> t >> g1 >> g2 >> g3 >> gj;
	
	if(abs(g1 - g2) <= t){
		score = (g1 + g2) / 2;
	}else{
		if((abs(g1 - g3) <= t && abs(g2 - g3) > t) || (abs(g1 - g3) > t && abs(g2 - g3) <= t)){
			if(abs(g1 - g3) >= abs(g2 - g3)){
				score = (g3 + g2) / 2;
			}else{
				score = (g3 + g1) / 2;
			}
		}else if((abs(g1 - g3) <= t && abs(g2 - g3) <= t)){
			score = max(max(g1,g2),g3);
		}else if((abs(g1 - g3) > t && abs(g2 - g3) > t)){
			score = gj;
		}
	}
	
	printf("%.1f",score);
	return 0;
}