<p>Given two integers <code>a</code> and <code>b</code>, return <em>the sum of the two integers without using the operators</em> <code>+</code> <em>and</em> <code>-</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> a = 1, b = 2
<strong>Output:</strong> 3
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> a = 2, b = 3
<strong>Output:</strong> 5
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>-1000 &lt;= a, b &lt;= 1000</code></li>
</ul>

class Solution:
    def getSum(self, a: int, b: int) -> int:
        mask = 0xffffffff  # 32-bit mask for handling overflow
        while b != 0:
            # Calculate sum without considering carry
            sum_without_carry = (a ^ b) & mask
            
            # Calculate carry
            carry = ((a & b) << 1) & mask
            
            # Update a and b for next iteration
            a = sum_without_carry
            b = carry
        
        # Handle overflow for negative numbers
        return a if a <= 0x7fffffff else ~(a ^ mask)

# Test the solution
solution = Solution()
print(solution.getSum(1, 2))  # Should print 3
print(solution.getSum(-1, 1))  # Should print 0
16400