def update_position(dir, x, y):
    """Returns the updated coordinates depending on the direction of the path"""
    if dir == 'DOWN':
        return x, y + 1
    elif dir == 'UP':
        return x, y - 1
    elif dir == 'LEFT':
        return x - 1, y
    elif dir == 'RIGHT':
        return x + 1, y