#include <iostream>
#include <iomanip>
using namespace std;

double absminus(double a,double b){
    if(a>=b)
        return a-b;
    else
        return b-a;
}

double maxdigit(double a,double b, double c){
    if(a>=b && a>=c)
        return a;
    else
        if(b>=a && b>=c)
            return b;
        else
            return c;
}

double averageclosest(double a,double b,double c){
    if(absminus(a,b)>=absminus(a,c))
        return (a+b)/2;
    else
        return (a+c)/2;
}

int main(){
    double p,t,g1,g2,g3,gj;
    double finalgrade;
    while(cin>>p>>t>>g1>>g2>>g3>>gj){
        if(absminus(g1,g2)<=t)
            finalgrade=(g1+g2)/2;
        else
            if((absminus(g3,g1)<=t) && (absminus(g3,g2)<=t))
                finalgrade=maxdigit(g1,g2,g3);
            else
                if((absminus(g3,g1)>t) && (absminus(g3,g2)>t))
                    finalgrade=gj;
                else
                    finalgrade=averageclosest(g3,g1,g2);
        cout.setf(ios::fixed);
        cout.precision(1);
        cout<<finalgrade<<endl;
    }
    return 0;
}