The objective of the present invention is to provide a novel compound which has 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 in 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