'While a member of Congress need only be an “inhabitant” of the state he or she represents, the president must have been a resident of the U.S. for at least 14 years. The Constitution, however, is vague on this point. For example, it does not make clear whether those 14 years need to be consecutive or the precise definition of residency. On this, Justice Story wrote, "by 'residence,' in the Constitution, is to be understood, not an absolute inhabitancy within the United States during the whole period; but such an inhabitancy, as includes a permanent domicile in the United States."'
Sounds like it's any period(s) adding up to fourtwent years.