Under construction

Still being built. Things may change

Star Arrangements

Time limit1sMemory limit512 MB

Summary
Given S stars, list every appealing row pattern a,b where alternating rows of a and b stars use exactly S stars.
Level

Easy3 of 10

Topics
Math, Brute force, Implementation
Solved
No attempts yet

Problem

Puerto Rico voted in favor of United States statehood, and flag makers are excited. A flag with 51 stars instead of the current 50 would mean a large jump in flag sales.

The current 50 star pattern is five rows of 6 stars interlaced with four offset rows of 5 stars. The two kinds of rows alternate until every star is placed.

* * * * * *
 * * * * *
* * * * * *
 * * * * *
* * * * * *
 * * * * *
* * * * * *
 * * * * *
* * * * * *

In this pattern adjacent rows differ by no more than one star, so the arrangement can be written compactly as the number of stars in the first row and the number in the second row. The pattern above is 6,5.

A 51 star flag with the same property can be three rows of 9 stars interlaced with three rows of 8 stars, written 9,8. If a state were to leave the union instead, seven rows of seven stars, written 7,7, is an appealing arrangement.

A flag pattern is visually appealing when all three conditions below hold.

  • Every other row has the same number of stars.
  • Adjacent rows differ by no more than one star.
  • The first row does not have fewer stars than the second row.

Your team looks past the immediate change to 51 stars and wants to sell flags for any union of three or more states. Given the number of stars SS to draw on a flag, find every visually appealing arrangement.

Input

The first line contains the number of stars SS to draw on the flag (3≤S≤327673 \le S \le 32767).

Output

On the first line, print SS followed by a colon. After that, print the compact representation of every visually appealing flag with SS stars, one per line.

Print the arrangements in increasing order of the number of stars in the first row. When two arrangements have the same first row, print the one with fewer stars in the second row first. The arrangement with a single row of SS stars and the arrangement with SS rows of one star are trivial, so do not print them.

Write each compact representation in the form "x,y", with exactly one comma between x and y and no other characters.

Examples3

  1. Example 1

    Input
    3
    
    Expected output
    3:
    2,1
    
  2. Example 2

    Input
    50
    
    Expected output
    50:
    2,1
    2,2
    3,2
    5,4
    5,5
    6,5
    10,10
    13,12
    17,16
    25,25
    
  3. Example 3

    Input
    51
    
    Expected output
    51:
    2,1
    3,3
    9,8
    17,17
    26,25