num = str(2**1000) sum = 0 for i in num: sum += int(i) print(sum)