Accepted: http://codeforces.com/contest/387/submission/5928451