#P6188. [NOI Online #1 入门组] 文具订购

[NOI Online #1 入门组] 文具订购

Problem Description

Xiaoming’s class has a total class fund of nn yuan. The students plan to use the fund to collectively buy 33 kinds of items:

  1. Compass, 77 yuan each.
  2. Pen, 44 yuan each.
  3. Notebook, 33 yuan each.

Xiaoming is responsible for ordering the stationery. Let the ordered quantities of compasses, pens, and notebooks be a,b,ca, b, c respectively. His ordering rules, in order, are:

  1. The nn yuan must be spent exactly, i.e. 7a+4b+3c=n7a + 4b + 3c = n.
  2. Subject to the above condition, the number of complete sets should be as large as possible, i.e. min(a,b,c)\min(a, b, c) should be as large as possible.
  3. Subject to the above conditions, the total number of items should be as large as possible, i.e. a+b+ca + b + c should be as large as possible.

Please help Xiaoming find the optimal plan that satisfies the conditions. It can be proven that if a plan exists, then the optimal plan is unique.

Input Format

The input contains only one line with one integer, representing the class fund amount nn.

Output Format

If there is no solution, output 1-1.

Otherwise, output one line with three integers a,b,ca, b, c separated by spaces, representing the numbers of compasses, pens, and notebooks.

1

-1
14

1 1 1
33

1 2 6

Hint

Explanation of Sample Input/Output 3

a=2,b=4,c=1a = 2, b = 4, c = 1 is also a plan that satisfies conditions 11 and 22, but for condition 33, this plan buys only 77 items in total, which is worse than the plan a=1,b=2,c=6a = 1, b = 2, c = 6.

Constraints

  • For test points 161 \sim 6, n14n \leq 14 is guaranteed.
  • For test points 7127 \sim 12, nn is guaranteed to be a multiple of 1414.
  • For test points 131813 \sim 18, n100n \leq 100 is guaranteed.
  • For all test points, 0n1050 \leq n \leq 10^5 is guaranteed.

Translated by ChatGPT 5