the black king stand chess field consist 109 row 109 column we consider row field number integer 1 109 the column similarly number integer 1 109 leave right we denote cell field locate ith row jth column ijYou know square give chess field allow all allow cell chess field give n segment each segment describe integer riaibi aibi denote cell column number ai number bi inclusive rith row allowedyour task find minimum number move king need square x0y0 square x1y1 provide move allow cell in word king locate allow cell waylet remind chess king neighboring cell two cell chess field consider neighboring share point