In the last rem digits one is added to the value obtained by equal distribution
if ( rem ) : NEW_LINE INDENT val += 1 NEW_LINE for i in range ( d - rem + 1 , d + 1 ) : NEW_LINE INDENT num = num + str ( val ) NEW_LINE DEDENT DEDENT return num NEW_LINE