Reformat problem 1 using lists