The twenty-one casks P31618


Statement
 

pdf   zip

thehtml

A sheikh had to pay three men with a batch of 21 equal wine casks, seven of them being full, seven half-full, and seven empty. How could Beremiz do the distribution, in such a way that each man received the same number of casks and the same amount of wine?

Input

Input consists in several natural numbers n, all between 2 and 106.

Output

For every n, print a line with “n:”. Then, print in three lines any way to divide n full casks, n ‍half-full casks and n empty casks among three men, so that each one receives n casks and the same total amount of wine. The i-th line must contain, separated by spaces, the number of full casks, half-full casks and empty casks that correspond to the i-th man. Follow the format of the samples exactly.

Public test cases
  • Input

    7
    7
    9
    

    Output

    7:
    3 1 3
    2 3 2
    2 3 2
    7:
    3 1 3
    3 1 3
    1 5 1
    9:
    3 3 3
    3 3 3
    3 3 3
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Spanish
    Other languages
    Spanish
    Official solutions
    C++
    User solutions
    C++