added solution for http://www.spoj.com/problems/ADDREV/