excercise from spoj.pl number 32