the mfloor m1 office international corporation CodeForces advanced elevator control system establish it work followsall office floor sequentially number integer 1 m at time t0 elevator floor elevator wait elevator floor Next time ti ti0 people come elevator for simplicity assume person use elevator report interval for person know parameter time person come elevator floor person initially floor want goThe movement elevator floor follow at time t t0 t integer elevator floor first elevator release people elevator want current floor then let people wait elevator floor if person come elevator exactly time t time we assume action go elevator instantly after elevator decide way time t1 elevator gets select floorThe elevator select direction move follow algorithm if elevator current time wait elevator floor elevator remain current floor Otherwise let assume elevator floor number x 1xm then elevator calculate direction priority pup pdown pup sum number people wait elevator floor number great x number people elevator want floor number great x pdown sum number people wait elevator floor number x number people elevator want floor number x if puppdown elevator go floor current floor x floor x1 elevator go floor current floor x floor x1 your task simulate work elevator person tell time elevator floor person need please note elevator large accommodate people