Algorithm(7)