in strategic computer game Settlers II build defense structure expand protect territory Lets building at moment defense structure accommodate exactly n soldier within task assume number soldier defense structure will not increase decreaseevery soldier rank natural number 1 k 1 stand private k stand general the high rank soldier well fight therefore player profit have soldier highest possible rankto increase rank soldier need train but soldier will not train free training session require golden coin on training session n soldier presentAt end training session soldier rank increase follow first soldier divide group rank possible number group form then group soldier rank k present exactly soldier increase rank oneYou know rank n soldier moment determine number golden coin need increase rank soldier rank k