program read
implicit none
integer N, flag, num
integer,dimension(3) :: A
read *, N, A(1), A(2), A(3)
flag = 0
do num = 1, 3, 1
	if (mod(A(num),2) == 0) then
    	if ((mod(A(num),3) == 0) .or. (mod(A(num),5) == 0)) then
  			flag = 1
        else
        	print *, 'DENIED'
        end if
    end if
end do  

print *, 'APPROVED'

end program read