I'm not sure what you mean by "straightforward correct answer".<p>I just used a big integer library, calculated the answer, and then took the first 10 digits.  That should work out fine in any reasonable general case that you're likely to be thinking of.