add_thousand_separators(n) that converts an integer n into a string with commas every three digits from the right (e.g. 1234567 becomes "1,234,567"), preserving a leading minus sign for negative numbers.n = 1234567
'1,234,567'
Digits are grouped into threes from the right.
n = -4200
'-4,200'
The minus sign is kept in front, outside the grouping logic.
n = 42
'42'
Numbers under 1000 need no comma.
Work with `str(abs(n))` and peel off the last 3 characters repeatedly.
Re-attach the minus sign at the end if n was negative.