solution of our team Dmitry&Leustagos for Amazon competition (3rd place)