The objecuve of the present invention is to provide a novel compound which nas a BTK inhibitory action and a cytostatic effect. Additionally, the objective of the present invention is also to provide a medicine useful for prevention and/or treatment of diseases i n which BTK is involved, in particular cancer, on the basis of the BTK inhibitory action. The present invention provides a compound represented by formula (I) [In the formula, R i to R3,W , A , Y and Z have the same meanings as deflnea m the specification.] or a salt thereof.