Problem 3 Russian Version