Step 1: Write the two conditions as equations.
Let the total number of sweets be \(N\), and let each of the 25 children receive \(x\) sweets. Since 8 sweets remain after equal distribution:
\[ N = 25x + 8 \]
If instead there were 28 children, 22 sweets would remain, so \(N - 22\) must be exactly divisible by 28.
Step 2: Combine the two conditions.
Substituting, \(25x + 8 - 22 = 25x - 14\) must be divisible by 28.
Rewrite \(25x - 14 = 28x - (3x+14)\). Since \(28x\) is already divisible by 28, we need \(3x + 14\) to be divisible by 28 as well.
Testing small values of \(x\): at \(x = 14\), \(3(14) + 14 = 42 + 14 = 56 = 28 \times 2\), which works, and it's the smallest such \(x\).
Final Answer:
Total sweets \(N = 25(14) + 8 = 350 + 8 = 358\). Checking: \(358 = 28(12) + 22\), confirming the second condition too. \[ \boxed{N = 358} \]