[Refer this Codeforces blog for details](http://codeforces.com/blog/entry/15296)
Refer this Codeforces blog for details