solved problem

http://codeforces.ru/contest/157/problem/A