The present invention relates to a bicyclic pyrimidine compound of the following formula (I) or a salt thereof.wherein R1 is lower alkyl, cyclic lower alkyl. etc. R2 is H, lower alkyl, lower alkenyl, etc. R3 is H, lower alkyl, lower alkenyl, etc. X is O, S or —N(R4)— R4 is H or lower alkyl or R2 and R4 may combine each other to form cyclic amino Y is amido, keto, sulfonyl, etc. R5 is H or lower alkyl Z is O or S m and n are 1 or 2. Said compound (I) or a salt thereof have MGAT inhibitory activity, and are useful as an agent for treatment or prophylaxis of adiposity, metabolic syndromes, hyperlipidemia, hyper neutral lipemia, hyper VLDL-mia, hyper fatty acidemia, diabetes mellitus, arteriosclerosis.