4. Sasha bought pencils in the store for 13 rubles each and pens for 20 rubles each, in total he paid 350 rubles. How many items of pencils and pens did Sasha buy in total?

#
# Solution.

Let $x$ be the number of pencils, $y$ be the number of pens. We get the equation $13 x+20 y=355$

$13(x+y)+7 y=355$, let $x+y=t(1)$

$13 t+7 y=355$

$7(t+y)+6 t=355$, let $t+y=k(2)$

$7 k+6 t=355$

$6(k+t)+k=355$, let $k+t=n(3)$

$6 n+k=355$

$k=355-6 n$. Substitute into (3), $t=7 n-355$

Substitute into (2), $y=710-13 n$

Substitute into (1), $x=20 n-1065$. Since $x>0, y>0$, then $n=54$. Therefore, $x=8, y=15$.

8 pencils and 15 pens, a total of 23 items.

Answer: 23.