naive way of doing problem 12 PE