Vasya like travel train do not like car travel locate tail trainVasya get train station the train consist n car index 1 n count locomotive head train three type event occur train move some number car add head train some number car add tail train Vasya recalculate value convenience car read at moment time index car head train start 1 note add new car head train indexing old one shiftTo choose car Vasya use value A_i car car index calculate follow at beginning trip a_i0 new car time addition during recalculation Vasya choose positive integer b s add A_i value b 1 cdot s Vasya have not decide train train event type want know index car value A_i minimal since lot car Vasya ask write program answer question