The total cost to cast Earthquake Dragon is locked in before you pay that cost. For example, if you control three Dragons, each with mana value 4, including one you can sacrifice to add , the total cost of Earthquake Dragon is . Then you can sacrifice the Dragon as you activate mana abilities just before paying the cost.