you enter competition give positive integer initialEnergy initialexperience denote initial energy initial experience respectivelyyou give 0indexed integer array energy experience length nYou face n opponent order the energy experience ith opponent denote energyi experiencei respectively when face opponent need strictly great experience energy defeat opponent availabledefeate ith opponent increase experience experiencei decrease energy energyibefore start competition train number hour after hour training choose increase initial experience increase initial energy onereturn minimum number training hour require defeat n opponent Example 1input initialEnergy 5 initialexperience 3 energy 1432 experience 2631output 8explanation you increase energy 11 6 hour training experience 5 2 hour trainingyou face opponent follow order you energy experience 0th opponent win your energy 11 1 10 experience 5 2 7 you energy experience 1st opponent win your energy 10 4 6 experience 7 6 13 you energy experience 2nd opponent win your energy 6 3 3 experience 13 3 16 you energy experience 3rd opponent win your energy 3 2 1 experience 16 1 17you total 6 2 8 hour training competition return 8it prove small answer existsexample 2input initialEnergy 2 initialexperience 4 energy 1 experience 3output 0explanation you need additional energy experience win competition return 0 constraintsn energylength experiencelength1 n 1001 initialEnergy initialExperience energyi experiencei 100