Implemented problems 5,6,7