solve codeforces 474D
solve codeforces 479B