The problem is that the multiplication blows the precision of the used format (either double for math.log(...) or the one the decimal module uses).
I had also thought about the intention of the question trying to get you to express the sum as bit operations (thought I admit that sounds like going for a very low-level profile), or maybe just "thinking outside the box".