Complete algorithm for h=0