To solve this problem we can use equation.
If we say that x is number of Sams pencils we can say too that Sari has 3x (because she has 3 times more)
And we know that together they has 28 pencils.
x+3x=28
4x=28 /:4 (divide both sides by 4)
x=7
Sam has 7 pencils.
We know that Sari has 3 times more so 7*3=21 -its the result.