def extract_arguments(fh):
    datasets = []
    while True:
        line = fh.readline().strip()
        if line == "0 0 0":
            break
        L, R, N = map(float, line.split())
        N = int(N)
        polygon = []
        for _ in range(N):
            x, y = map(int, fh.readline().strip().split())
            polygon.append((x, y))
        datasets.append((L, R, N, polygon))
    return datasets

# Example usage:
# with open("input.txt", 'r') as fh:
#     data = extract_arguments(fh)
#     for dataset in data:
#         L, R, N, polygon = dataset
#         print(f"L: {L}, R: {R}, N: {N}, polygon: {polygon}")