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