#P9796. Proper Fraction Decomposition

    ID: 22942 Type: Default 1000ms 256MiB

Proper Fraction Decomposition

Proper Fraction Decomposition

Given an integer n, decompose the rational number $$1-\frac{1}{n}$$ into a sum of one or more proper fractions of the form $$\frac{a_i}{b_i}$$ such that:

  • Each fraction is proper, i.e. $$a_i < b_i$$.
  • The denominator $$b_i$$ divides n.
  • $$\sum_{i=1}^{k}\frac{a_i}{b_i} = 1-\frac{1}{n}$$.

You are allowed to output any valid decomposition. It can be proved that when n >= 2, the fraction $$1-\frac{1}{n}$$ itself is a proper fraction. Thus, one possible answer is simply $$\frac{n-1}{n}$$.

inputFormat

The input consists of a single integer n (2 <= n <= 10^9), given on one line.

outputFormat

Output the decomposition in the following format:

  1. Print an integer k on the first line, denoting the number of fractions in your decomposition.
  2. Then print k lines, each containing two positive integers a_i and b_i (separated by a space) representing the fraction $$\frac{a_i}{b_i}$$.

sample

2
1

1 2

</p>