PivotOJ

Easy Equation

시간 제한: 1000ms메모리 제한: 512MB출처: CERC 2016BOJ 13949

문제

Given an integer k greater than 1, it is possible to prove that there are infinitely many triples of positive integers (a, b, c) that satisfy the following equation:

a2 + b2 + c2 = k (ab + bc + ca) + 1.

Given positive integers n and k, find n arbitrary triples (a1, b1, c1), (a2, b2, c2), . . . , (an, bn, cn) that all satisfy the equation. Furthermore, all 3n integers a1, . . . , an, b1, . . . , bn, c1, . . . , cn should be different positive integers with at most 100 decimal digits each.

입력

The first line contains two integers k and n (2 ≤ k ≤ 1 000, 1 ≤ n ≤ 1 000) — the constant k in the equation and the target number of triples.

출력

Output n lines. The i-th line should contain three space separated integers ai , bi and ci with at most 100 digits each — the i-th of the solutions you found.

예제

예제 1

입력
2 8
출력
1 2 6
3 10 24
12 35 88
15 28 84
4 5 18
14 33 90
40 104 273
21 60 152

예제 2

입력
3 3
출력
1 3 12
8 21 87
44 165 615
코드를 제출하려면 로그인하세요.