pat solution(3)