This Friday is going to be an especially good one for the lucky winner of this week’s Mega Millions jackpot, which is estimated at $502 million. It’s the fourth-highest jackpot in the lottery’s history. While the size of the prize may suggest that winning is impossible, the mathematics of winning a lottery assure us: We all still have a chance!

Of course, our chances are all very bad. Winning the Mega Millions jackpot means selecting the right six non-duplicate numbers: five numbers ranging from 1 to 70, and one special number (the yellow Mega ball) ranging from 1 to 25. The odds of doing so are one in 302,575,350 (for scale, the population of the United States is 325.7 million). Calculating those odds is done using the mathematical law of combinations, which is basically a way of counting all the different ways a set of things — in this case numbered balls — can be selected, regardless of order.

The number of combinations exponentially increases as the size of your set (the number of balls) increases. If this lottery were a game involving only one ball, the odds of winning would be one in 70, since the balls are only numbered from 1 to 70. If it involved two balls, both drawn from the same pool, it would be one in *2,415*. If you’re thinking “Wow, that’s a huge-ass jump!”, you are not wrong.

The jump is so big because the law of combinations says you have to multiply the the odds of selecting the correct first ball with the odds of selecting the correct second ball — which is one in 69 (nice), since the 70th ball was already drawn out of the pool the first time around. Multiplying 1/70 by 1/69 gives you 1/4,830, which really sucks. But fortunately, since you can pick the two numbers in any order, the law of combos says you can divide *that* number by the number of different ways that a sequence of 2 numbers can be written down (in this case, 2 factorial, or just 2), giving you 1/2,415. Now, imagine doing that five more times, multiplying by 1/68, then 1/67, and so on. Even after you divide by the appropriate factorials, the resulting number is going to be huge — so huge you might think it’s not worth the two bucks to buy a ticket in the first place. But then again: $502 million!

Mega Millions odds are slightly complicated by that funny sixth ball, picked from a different set from 1 to 25. It actually makes the odds a little less terrible (though still terrible), since it means that your last round of calculations involves multiplying by 1/25 rather than 1/65.

That said, those slim odds are what make the lottery so exciting. Humans love irrational hope, even if it’s fleeting; as psychologists explained in a 2008 paper, we love the lottery because we *feel* poor — and taking that one in 302,575,350 chance offers us a brief, golden moment to dream of a better, baller life.