I thought it was all right with the code... but i'm not getting to the answer I want...
That's the input file i have to use to solve it
3575
That's the answer
3576
That's what I am getting.......