Algorithm in comments for c1206.c