```
class Solution(object):
def getSum(self, a, b):
def add(a,b):
ans = 0
while b:
ans = a^b
b = (a&b)<<1
a = ans
return ans
def sub(a,b):
temp = add(1,~b)
return add(a, temp)
#print ~1,~0,~(-1),~(-2),~(-3),~(-4),~(-5),~(-6),~(-7),~(-8)
#1.sub(8, (-3)) is ok, a,b=8,3
#2.sub(-8, (-3)) is ok, a,b=-8,3,value=a+b=-5
#3.sub(-8, 3) is ok, a,b=-8,-3,value=a+b=-11
#4.sub(8, 3) is error, a,b=8,-3,value=a+b=5,but failed, I made a=-8,b=3,because of step2.get -sub(-a, b) as results.
#5.sub(-3, -8) is error
if a>=0 and b>=0:
return add(a, b)
elif a<0 and b>=0:
if -a > b:
return sub(a, -b)
else:
return -sub(-b, a)
elif a>=0 and b<=0:
if a < -b:
return sub(b, -a)
else:
return -sub(-a ,b)
else:
if a>b:
return sub(b,-a)
else:
return sub(a,-b)
a = Solution()
numa, numb = 5,17
#numa, numb = 3,-8
#numa, numb = -3,-8
#numa, numb = -8,3
#numa, numb = -3,8
#numa, numb = 3,-8
#numa, numb = 8,-3
#numa, numb = -8,-3
#numa, numb = -3,-8
numa, numb = -1, 1
print a.getSum(numa, numb)
```

I don't like rules. But it is useful. Could you have more good?