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