Solution to problem 16 (probably not proper one)