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