#P12254. Beautiful Intervals

    ID: 14361 Type: Default 1000ms 256MiB

Beautiful Intervals

Beautiful Intervals

Given two integers K and N, you are required to construct N beautiful intervals [Li, Ri] that satisfy the following conditions:

  • $L_1 = 1$.
  • $L_i \le R_i$ for all $i$.
  • $R_i - L_i \ge K$ for all $i$.
  • For any $i > 1$, $L_i = R_{i-1} + 1$.
  • $\gcd(L_i, R_i) = 1$, where $\gcd$ denotes the greatest common divisor.
  • Under the above conditions, the difference $R_i - L_i$ should be as small as possible for each interval.

Your task is to produce the N intervals following these requirements.

inputFormat

The input consists of a single line containing two space-separated integers K and N, where K is the minimum required difference and N is the number of intervals to construct.

outputFormat

Output N lines. Each line contains two integers L and R separated by a space, representing one beautiful interval [L, R].

sample

1 3
1 2

3 4 5 6

</p>