Result

AC

Code [DL]

$'d'
 -(!!)()()#
$'P'
 -1s(!!){d}o()()0g#
$'p'  #
 -{P}<
  #{p}-@
$'f'
 -(!!)2c(!c!)(!y!)()(y){p}(!P!)(!!)(c)()9()g#
$'g'-i2mc2c(!e!)1a(!!)0()p()z1sc(!!)(!d!)()p(e)p{g}#
 -e<
    #
$'h'  #
 -{f}<
#{h}a1-@
$'main'
 -[00000]{d}p{d}p{g}0{h}#

stdin

6597248905419779056495268598553540415820140060002384006554088291913029448279288750376076196675219711

stdout

0000000000000001111111112222222223333444444444455555555555556666666667777777778888888888999999999999

stderr

strace