Do I take PLAN B right after I’ve had unprotected sex ?

So my boyfriend pulled out and it was all over my sheets but we think that he pre cum Inside either that or I came. We’re not sure and I don’t know when to take the pill .