The present invention provides the following compounds having anti-viral activity.A1 is CR1AR1B, S or O;A2 is CR2AR2B, S or O;A3 is CR3AR3B, S or O;A4 is CR4AR4B, S or O;the number of hetero atoms among atoms constituting the ring which consists of A1, A2, A3, A4, nitrogen atom adjacent to A1 and carbon atom adjacent to A1, is 1 or 2;R1A and R1B are each independently hydrogen, halogen, alkyl, or the like;R2A and R2B are each independently hydrogen, halogen, alkyl, or the like;R3A and R3B are each independently hydrogen, halogen, alkyl, or the like;R4A and R4B are each independently hydrogen, halogen, alkyl, or the like;R3A and R3B may be taken together to form non-aromatic carbocycle or non-aromatic heterocycle;X is CH2, S or O;R1 is each independently halogen, hydroxy, or the like;m is any integer of 0 to 2; andn is any integer of 1 to 2.