• + 1 comment

    When using Python to solve this problem, you might have three cases failing. This online editor will not give your error info, but if you run the same code in VSCode, the error message is "ValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit".

    So the reason is the value is too big and even max string digits could not contain it. Solution is to add the following at the top of your code: import sys

    sys.set_int_max_str_digits(60000)