The present invention provides to a compound having an ACC inhibitory action, which is useful as an agent for the prophylaxis or treatment of obesity, diabetes, hypertension, hyperlipidemia, cardiac failure, diabetic complications, metabolic syndrome, sarcopenia, cancer and the like, and has superior efficacy.The present invention relates to a compound represented by the formula (I):wherein each symbol is as defined in the specification.