Yeast infection question

I just used monistat 3 for the first time at 7:00pm what will happen if I have sex at like 6:00am the next morning? Will it still work?