This code solves Peng's hospital arriving problem.