Plan b

How long after unprotected sex can you take plan b for it to still work?