http://codeforces.com/group/1EzrFFyOc0/contest/716/submission/40932826 http://codeforces.com/group/1EzrFFyOc0/contest/716/problem/D http://acm.hdu.edu.cn/showproblem.php?pid=6386