Wrong output for AC code

this code is givng output as 327828114109 for input 9 instead of -1

problem (practice) and contest link