class Solution(object):

def reverse(self, x):

s=""

temp=x

if x<0:

x=abs(x)

carryover,remainder = divmod(x,10)

s += str(remainder)

while(carryover):

carryover,remainder = divmod(carryover,10)

s += str(remainder)

if -int(s)<-2147483648:

s="0"

if temp<0:

s = -int(s)

return s

else:

return int(s)