Sahih al-Bukhari 1816
Sahih‘Abdullāh ibn Ma‘qil reported: I sat with Ka‘b ibn ‘Ujrah and asked him about the ransom and he replied: "It (the verse) was revealed concerning my case specifically, but it is also meant for you in general. I was carried to the Messenger of Allah (may Allah's peace and blessings be upon him) and lice were falling on my face. He said: ‘I never thought your ailment has reached such an extent. Can you afford a sheep (as a ransom for shaving your head)?’ I replied: ‘No.’ He then said: ‘Fast three days, or feed six poor people.'" In another narration: "The Messenger of Allah (may Allah's peace and blessings be upon him) ordered him to either feed six people three Sā‘ (each will take half a Sā‘), slaughter a sheep as a sacrifice, or fast three days."