http://www.spoj.com/problems/NEG2/

if u do not understand the conversion there is a beautiful explanation here http://mathematics.knoji.com/how-to-convert-a-decimal-number-into-negative-base-a-tutorial/