View source for Shift and add algorithm