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