def parse_index(text: str) -> int:
    """ Parse an index from a string """

    try:
        if text.startswith('+'):
            raise Exception

        num = int(text)
        if num > 0:
            return num - 1
        else:
            raise Exception
    except Exception:
        raise ValueError(f'Invalid index value "{text}"')