1# Runtime: 17 ms (Top 24.0%) | Memory: 13.24 MB (Top 48.1%)234class Solution(object):5def thousandSeparator(self, n):6"""7:type n: int8:rtype: str9"""10n = str(n)11if len(n) <= 3:12return str(n)13result = ""14dot = "."15index = 016startPos = len(n) % 317if startPos == 0:18startPos += 319val = -120while index < len(n):21result += n[index]22if index == startPos - 1:23result += dot24val = 025if val != -1:26val += 127if val > 3 and (val - 1) % 3 == 0 and index != len(n) - 1:28result += dot29val = 130index += 13132return result