5. At the Sea Meetings, a competition in games by the sea and in the pool, 8 people from Dubrovnik, 7 from Zadar, 2 from Hvar, and 3 from Split participate. They need to form a five-member team in which there will be at least one competitor from each of the four cities. In how many different ways can the team be formed?

## NATIONAL MATHEMATICS COMPETITION
5. At the Sea Meetings, a competition in games by the sea and in the pool, 8 people from Dubrovnik, 7 from Zadar, 2 from Hvar, and 3 from Split participate. They need to form a five-member team in which there will be at least one competitor from each of the four cities. In how many different ways can the team be formed?

## Solution.

Let D denote a competitor from Dubrovnik, Z a competitor from Zadar, H a competitor from Hvar, and S a competitor from Split.

According to the conditions of the problem, the following teams are possible: DDZHS, ZZDHS, HHDZS, and SSDZH.

When forming the DDZHS team, two competitors from Dubrovnik can be chosen in $\frac{8 \cdot 7}{2}=28$ ways, one competitor from Zadar in 7 ways, one competitor from Hvar in 2 ways, and one competitor from Split in 3 ways. The total number of DDZHS teams is $28 \cdot 7 \cdot 2 \cdot 3=1176$.

When forming the ZZDHS team, two competitors from Zadar can be chosen in $\frac{7 \cdot 6}{2}=21$ ways, one competitor from Dubrovnik in 8 ways, one competitor from Hvar in 2 ways, and one competitor from Split in 3 ways. The total number of ZZDHS teams is $21 \cdot 8 \cdot 2 \cdot 3=1008$.

When forming the HHDZS team, both competitors from Hvar are team members, so they can be chosen in only 1 way, one competitor from Dubrovnik in 8 ways, one competitor from Zadar in 7 ways, and one competitor from Split in 3 ways. The total number of HHDZS teams is $1 \cdot 8 \cdot 7 \cdot 3=168$.

In the fourth case, when forming the SSDZH team, two competitors from Split can be chosen in $\frac{3 \cdot 2}{2}=3$ ways, one competitor from Dubrovnik in 8 ways, one competitor from Zadar in 7 ways, and one competitor from Hvar in 2 ways. The total number of SSDZH teams is $3 \cdot 8 \cdot 7 \cdot 2=336$.

The team can be formed in $1176+1008+168+336=2688$ ways.

## NATIONAL MATHEMATICS COMPETITION