Problem 4 prolog