Subtract ways for all slots that exactly fill less than i slots
for j in range ( 1 , i ) : NEW_LINE INDENT ways [ i ] = ( ( ways [ i ] - bin [ i ] [ j ] * ways [ j ] ) % mod + mod ) % mod NEW_LINE DEDENT