This program supports only unsigned addition and multiplication of base-10 integers. The maximum size of a word represented in the "digits" data structure can be adjusted by modifying the constructor. Large word lengths will cause problems if the sum or product of digits ends up exceeding 2^{53}-1.

9999999999999999 is an interesting value to experiment with. I had to bring the word length all the way down 7 to get the expected value (10^{17}-1)^{2}=99999999999999980000000000000001.