there n house city arrange axis point h_1 h_2 ldot h_n you want build new house consider option place point p_1 p_2a like visit friend calculate advance distance option exist house more formally calculate array d_1 d_2 d_i j leftp_i h_jright x define absolute value xAfter long time inactivity forget location house h option p_1 p_2 but diary keep arrays d_1 d_2 authenticity doubt also value inside array shuffle value position d_1 d_2 correspond different house pay attention value array word value array d_1 correspond distance p_1 house array d_2 p_2 housesalso pay attention location house h_i consider option p_j match for example location correct h 1 0 3 3 p 1 1 correspond shuffle d_1 0 2 1 2 d_2 2 2 1 0check location house h consider point p_1 p_2 found array distance correct if possible find appropriate location house consider option