You are to simulate the movements of an elevator, which works according to the following rules:
The elevator stays 3 seconds for customers to get in or get out. If some customers want to get in and some want to get out, the elevator stays 6 seconds.
It takes the elevator 2 seconds to go one story upwards or downwards.
When there is no request for service, the elevator stays where it is. Namely, it is idle.
When the elevator is idle, and a request comes from upwards or downwards, it moves upwards or downwards. If a request comes from the story where it stays, the elevator opens its door to serve these customers.
When the elevator goes upwards or downwards, it keeps its direction until there is no request from upwards or downwards. However, it breaks off to let customers get out or pick up customers if necessary.
If the elevator is to go upwards or downwards, it does not accept customers intending to go upwards or downwards.
When the elevator can act more than one way according to aforementioned rules, it chooses the action with the highest priority. The priorities for actions, from the highest to the lowest, are:
let customers get out
let customers get in
go downstairs
go upstairs
Initially (at time 0), the elevator is in the 0th story, and it is idle. Given the requests, you are to output how the elevator moves in a designated interval. Suppose that each request comes at an integer second.