def get_pos():
    while True:
        masked_index = 0
        try:
            masked_index = int(input())
            return masked_index
        except:
            print('Enter valid number: (0 to quit)')
            masked_index = int(input())
            if (masked_index == 0):
                print('Quitting')
                sys.exit()
            return masked_index
def get_pos():
    while True:
        masked_index = 0
        try:
            masked_index = int(input())
            return masked_index
        except:
            print('Enter valid number: (0 to quit)')
            masked_index = int(input())
            if (masked_index == 0):
                print('Quitting')
                sys.exit()
            return masked_index