The present invention provides a compound of formula (I):wherein R1a is optionally substituted C1-6 alkyl, etc.; R1m is hydrogen atom, etc.; G1, G2, G3 and G4 are (i), etc. ((i) G1 is -N(R1b)-, G2 is -CO-, G3 is -C(R1c)(R1d)-, and G4 is oxygen, etc.); R1b is optionally substituted C1-6 alkyl, etc.; R1c and R1d are each independently optionally substituted C1-6 alkyl, etc.; R2 is optionally substituted C1-6 alkyl, etc.; R3a, R3b, R3c, and R3d are each independently a group: -A-B (A is a single bond, etc., B is hydrogen atom, etc.), etc.; n is 1, etc.; R5 is C1-4 alkoxycarbonyl, etc., or a pharmaceutically acceptable salt thereof, which is useful as a renin inhibitor.