Provided is a novel compound having BTK inhibitory action and a cell proliferation suppressing effect. Also provided is a medicine useful for the prevention and/or treatment of a disease associated with BTK, particularly cancer, based on BTK inhibitory action. A compound represented by formula (I) [wherein R 1 to R 3 , W, A, Y and Z respectively have the meanings as defined in the specification], or a salt thereof is disclosed.