#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int p,t,g1,g2,g3,gj;
    double score;
    while(cin>>p>>t>>g1>>g2>>g3>>gj){
        if(abs(g1-g2)<=t)score=(g1+g2)/2.0;
        else if(abs(g1-g3)<=t&&abs(g2-g3)<=t){
            score=g1>g2?g1:g2;
            score=score>g3?score:g3;
        }
        else if(abs(g1-g3)<=t)score=(g1+g3)/2.0;
        else if(abs(g2-g3)<=t)score=(g2+g3)/2.0;
        else score=gj;
        printf("%.1lf\n",score);
    }
    return 0;
}