P, Q = map(int, input().split()) ans_list = [] for M in range(1, 10 ** 8): if Q - P * M != 0: if (-M * Q) % (Q - P * M) == 0: N = (-M * Q) // (Q - P * M) if N > 0: ans_list.append((N, M)) ans_list.sort() print(len(ans_list)) for t in ans_list: print(*t)