from decimal import *
with localcontext() as ctx:
    ctx.prec = 32
p = ctx.power(3, idx)
depart = ctx.exp(-3) * p
depart /= math.factorial(idx)
OverflowError: long int too large to convert to float in python