Provided is a novel compound having a selective JAK3-inhibitory effect and also having excellent oral absorbability. Also provided is a pharmaceutical agent, which is based on a JAK3-inhibitory effect and is useful for preventing and/or treating a disease involving the JAK3, and in particular, rheumatoid arthritis or multiple sclerosis.An azaindole derivative having a cycloalkenyl group, which is represented by the following formula (I), or a salt thereof, and a pharmaceutical composition containing the same:where R1 to R4, m and n have the same meanings as those defined in the description.