아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

The Math of Sailing

시간 제한1초메모리 제한512 MB

요약
천 네 조각의 크기를 줄여 네 돛에 배치해 두 식의 값이 같으면서 최대가 되도록 만든다.
난이도

보통10점 중 7점

유형
수학, 그리디, 구현
정답자
아직 제출이 없습니다

문제

Captain Polycarp has been dreaming about owning a three-mast sailing ship since he was a child. And at last, his dream is about to come true, he has saved enough money and bought a beautiful caracca "Pulcheria". However he overlooked the fact that it was sold without any sails on, so now he has to find them separately.

Caracca should have exactly four sails: one on the back mast, one on the front one, and two on the middle one. And Polycarp, coincidentally, has exactly four pieces of fabric with sizes t_1t\_1, t_2t\_2, t_3t\_3 and t_4t\_4. Polycarp can use those fabric pieces as sails in any order, making them smaller beforehand, if needed.

Let's denote the size of the front mast sail as a_1a\_1, the sizes of the middle mast sails as a_2a\_2 and a_3a\_3 and the size of the back mast one as a_4a\_4. The maneuverability of the ship is calculated as a_1a_4+a_2+a_3a\_1 a\_4 + a\_2 + a\_3 and its stability is calculated as a_1+a_4+a_2a_3a\_1 + a\_4 + a\_2 a\_3.

For the caracca to walk the sea safely captain has to adjust the sails in such a way that the maneuverability of the ship is equal to its stability. And for maximum comfort, these two values should be as large as possible.

To sum it up, Polycarp has to lower the values of t_1,…,t_4t\_1, \ldots, t\_4 if needed, and then distribute the resulting sizes among the four sails in any order so that the following equality will hold and both of its sides will be maximal possible: a_1a_4+a_2+a_3=a_1+a_4+a_2a_3a\_1 a\_4 + a\_2 + a\_3 = a\_1 + a\_4 + a\_2 a\_3.

Help him find a way to make the ship's maneuverability equal to its stability while maximizing both of these equal values.

입력

The first and only line of input contains four integers t_1t\_1, t_2t\_2, t_3t\_3 and t_4t\_4 --- the sizes of pieces of fabric Polycarp has (1≤t_i≤1041 \leq t\_i \leq 10^4).

출력

In the first line of output print pp --- a permutation of integers from 11 to 44, the ii-th number in it should specify from which piece of fabric was the ii-th sail created. For example, if the second sail was created by decreasing the size of the fourth piece of fabric then p_2=4p\_2 = 4.

In the second line print space-separated values a_1a\_1, a_2a\_2, a_3a\_3 and a_4a\_4 --- the resulting sizes of the sails (1≤a_1,a_2,a_3,a_4≤1041 \leq a\_1, a\_2, a\_3, a\_4 \leq 10^4). These values don't have to be integers.

Your answer is accepted if the absolute error of the resulting maneuverability and stability compared to the correct answer does not exceed 2⋅10−62 \cdot 10^{-6} and both of those values differ from each other by no more than 10−610^{-6}.

예제3

  1. 예제 1

    입력
    1 1 1 1
    
    예상 출력
    1 2 3 4
    1.0 1.0 1.0 1.0
    
  2. 예제 2

    입력
    7 5 3 5
    
    예상 출력
    1 2 4 3
    7.0 4.0 5.0 3.0
    
  3. 예제 3

    입력
    2 3 4 5
    
    예상 출력
    1 2 3 4
    2.0 2.3333333333 4 5