SPOJ Problem

Problem statement: https://www.spoj.com/problems/ARITH/
Solution Link: https://ideone.com/yNg2c7
Okay, so the test case that is not working is 100000000000000000-1.(idk why)
Can anyone explain please?
And are there any more test cases where my code fails?
(PS: yeah it’s really brute forced) :sneezing_face: