What happens first at the beginning of an epoch, stake snapshot or payment of rewards?

I haven’t seen this answered anywhere. It only makes a difference because I want to get it right in a spreadsheet I’m setting up.

As I understand it, at the beginning of epoch N, you earn rewards based on the balance you had in the delegated wallet at the stake snapshot that happened at the beginning of epoch N-3.

At the beginning of epoch N, the balance you have in the delegated wallet at the stake snapshot will determine your reward at the beginning of epoch N+3, as a fraction of the pool’s reward.

So does the stake snapshot at the beginning of epoch N include the reward paid out in epoch N, or not?