Generate an explanation, analysis, and plan to generate code prompt for the last task considering the example task instances. Your plan should show enough intermediate reasoning steps towards the answer and will be applied only the each of the instances. Construct the plan as much as you can and describe the logic specifically. When constructing the plan for the code prompt, actively use 'if else statement' to take different reasoning paths based on the condition, 'loop' to efficiently process the repititive instructions, 'dictionary' to keep track of connections between important variables, and 'print()' to output enough intermediate reasoning steps towards the answer and keep tracking changes of important variables. When analyzing the task, you should carefully decide whether the task needs variable tracking, the free format reasoning approach, or both of them. The variables tracking is effective when the task has multiple instructions or statements to process. For the free format reasoning, it works well when the task needs a complex or diverse logic to implement. In a free format reasoning step, you don't have to specify the logic, but you should specify an abstract fucntion like 'derive_answer_with_explantion' which outputs both reasons and proper answer for the situation.

{exemplars}