404191: GYM101446 E Construct the Polygon

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Construct the Polygontime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

Construct a convex polygon with the following properties (ot determine that the construction is impossible):

  • Coordinates of all vertices of the polygon are integers.
  • All coordinates satisfy the inequalities 0 ≤ xi ≤ n, 0 ≤ yi ≤ m.
  • Number of vertices should not exceed 105.
  • No three vertices of the polygon lie on a common straight line.
  • Area of the polygon is equal to S.
Input

The only line of input contains two positive integers n and m (1 ≤ n, m ≤ 105) — upper bounds on coordinates, and one real number S (0 < S ≤ 109) — desired area of the polygon given with at most 6 digits after the decimal point.

Output

If it is impossible to construct a suitable polygon, print  - 1.

Otherwise, on the first line print k — number of vertices in your polygon (3 ≤ k ≤ 105). On each of the next k lines print xi and yi — coordinates of the vertices of the polygon (0 ≤ xi ≤ n, 0 ≤ yi ≤ m) listed in clockwise order.

ExamplesInput
10 10 81
Output
5
0 0
0 7
9 9
10 9
10 0
Input
1 2 0.5
Output
3
0 0
0 1
1 1

加入题单

上一题 下一题 算法标签: