def parse_position(string):
    """
    >>> parse_position('3,000,000')
    3000000
    >>> parse_position('3M')
    3000000
    >>> parse_position('3kk')
    3000000
    """
    units = ''
    for index, char in enumerate(string):
        if char.lower() in ['k', 'm']:
            units = string[index:]
            string = string[:index]
            break
    pos = float(string.replace(',', ''))
    for char in units:
        if char.lower() == 'k':
            pos *= 1000
        if char.lower() == 'm':
            pos *= 1000000
    pos = int(pos)
    return pos