O

Problem description

A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larger than the middle car, and the middle car is strictly larger than the smallest car.

Masha came to test these cars. She could climb into all cars, but she liked only the smallest car.

It's known that a character with size a can climb into some car with size b if and only if a ≤ b, he or she likes it if and only if he can climb into this car and 2a ≥ b.

You are given sizes of bears and Masha. Find out some possible integer non-negative sizes of cars.

Input

You are given four integers V1V2V3Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3.

Output

Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively.

If there are multiple possible solutions, print any.

If there is no solution, print "-1" (without quotes).

Examples

Input

50 30 10 10

Output

50
30
10

Input

100 50 10 21

Output

-1

Note

In first test case all conditions for cars' sizes are satisfied.

In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20.

解题思路:假设一只熊的体积为V,一辆车的体积为C,则有如下三种情况:

①熊不能进去的车满足:V>C;

②熊能进去但不喜欢的车满足:V<2*V<C;

③熊能进去而且喜欢的车满足:V<=C<=2*V。

设三辆车的体积分别为C1、C2、C3,其关系严格递减即C1>C2>C3。父亲,母亲,儿子分别能进去和喜欢自己的车满足:Vi≤Ci≤2*Vi,(i=1,2,3)。

其中玛莎来做测试,要使玛莎能进去所有的车,则玛莎的体积只需不大于中等的车:Vm<=C3<V2<=C2;因为玛莎和儿子都喜欢体积最小的车,所以最小车的体积至少为max(Vm,V3)。如果Vm>=V3,此时最小车的体积为Vm,儿子能进去且喜欢它满足:2*V3>=C3>=Vm>=V3;如果Vm<V3,玛莎能进去且喜欢它满足:2*Vm>=C3>=V3>Vm。因此,不满足情况的有Vm>2*V3或者V3>2*Vm或者Vm>=V2,此时输出-1。否则输出C1、C2、C3的值。我们继续推导下去:以上已经求出最小车的体积为C3=max(Vm,V3);假设儿子的体积刚好为最小车的体积,则儿子能进去母亲的车但不能喜欢她的车满足:2*V3<=2*C3<C2,又V2<=C2<=2*V2,所以C2(min)=max(2*C3+1,V2)∈[C2,2*V2];同理可得母亲能进去父亲的车但不能喜欢他的车满足:V2<=C2<=2*V2<C1,又V1<=C1<=2*V1,所以C1(min)=max(2*V2+1,V1)∈[C1,2*V1]。

AC代码:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main(){
 4     int v1,v2,v3,vm;
 5     cin>>v1>>v2>>v3>>vm;
 6     if((vm>2*v3)||(v3>2*vm)||(vm>=v2))cout<<"-1"<<endl;
 7     else{
 8         v3=max(v3,vm);//v3为三辆车中最小的体积
 9         cout<<max(2*v2+1,v1)<<"
"<<max(2*v3+1,v2)<<"
"<<v3<<endl;
10     }
11     return 0;
12 }
原文地址:https://www.cnblogs.com/acgoto/p/9158113.html