原题有条件:
Long integers (signed 32-bit) will be adequate for all solutions.
即
保证答案可以用 32 位有符号整数表示。
这对于本题来说是必要的。