http://acm.hdu.edu.cn/webcontest/contest_showproblem.php?pid=1001&ojid=0&cid=7654&hide=1&problem=Problem%20%20A