http://codeforces.com/contest/336/problem/C