Template for problem 31