Run id: 89549

------Input------
389 1 24
------Answer-----
365
------Your output-----
366