Task number: 3490
A souvenir vendor has the following figures for sale: three identical figures of Pope John Paul II, four of Juraj Jánošík and five of the Good Soldier Švejk. In how many ways can he arrange the figures into a single row in a shop window such that all the figures of the same person never form a single contiguous block?
In how many ways can we arrange 5 Czechs, 4 Slovaks a 3 Poles in a single line such that all the members of a single nationality never form a contiguous block?
Unlike in the previous variant, all the people are mutually distinguishable.