A fused heterocyclic compound having an enteropeptidase inhibiting action, and the use of the compound as a therapeutic or prophylactic agent for obesity, diabetes and the like. Specifically, a compound represented by the formula (I) or a salt thereof: Wherein each symbol is as defined herein, And the use of the compound as a therapeutic or prophylactic agent for obesity, diabetes, and the like.엔테로펩티다아제 저해 작용을 갖는 융합 헤테로시클릭 화합물, 및 상기 화합물의 비만, 당뇨병 등의 치료 또는 예방용 의약으로서의 용도가 제공된다. 구체적으로는, 식 (I) 로 나타내는 화합물 또는 이의 염:[식 중, 각 기호는 본원에서 정의한 바와 같음],및 상기 화합물의 비만, 당뇨병 등의 치료 또는 예방용 의약으로서의 용도가 제공된다.