One test case not working

ur code does not handle input 1
for input =1 answer is 367