Problem 3 prolog