Updated flowchart for problem 3