def get_mode(operation, i):
    """
    >>> get_mode(101, 0)
    1
    >>> get_mode(1, 0)
    0
    >>> get_mode(1101, 0)
    1
    >>> get_mode(1001, 0)
    0
    >>> get_mode(1101, 1)
    1
    >>> get_mode(1001, 1)
    1
    
    """
    if len(str(operation)) > i + 2:
        mode = int(str(operation)[-i-3])
    else:
        mode = 0
    return mode