the S-1 Algorithm