#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param x int整型 
# @return int整型
#
class Solution:
    def reverse(self , x: int) -> int:
        # write code here
        flag = 0
        if x<0:
            flag = -1
        s = str(abs(x))[::-1]
        if flag:
            tep = int('-'+s)
            if tep < -2**31:
                return 0
            return tep
        else:
            tep = int(s)
            if tep > 2**32 - 1:
                return 0
            return tep