http://codeforces.com/contest/379/problem/A
http://codeforces.com/contest/379/problem/B