Using fold to compute label offsets