#include <iostream> using namespace std; int main() { double p,t,g1,g2,g3,gl; while(cin>>p>>t>>g1>>g2>>g3>>gl){ double res=0; if(abs(g1-g2)<=t){ printf("%.1lf",(g1+g2)/2); }else{ int l1=g1-t,r1=g1+t; int l2=g2-t,r2=g2+t; if((g3>=l1&&g3<=r1)&&(g3<l2||g3>r2)){ printf("%.1lf",(g1+g3)/2); }else if((g3>=l2&&g3<=r2)&&(g3<l1||g3>r1)){ printf("%.1lf",(g2+g3)/2); }else if(g3>=l1&&g3<=r1&&g3>=l2&&g3<=r2){ printf("%.1lf",max(max(g1,g2),g3)); }else{ printf("%.1lf",gl); } } } return 0; }