#include<bits/stdc++.h>
using namespace std;
int main(){
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
// 1号小朋友分糖果
int share1 = a / 3;
a = share1;
b += share1;
e += share1;
// 2号小朋友分糖果
int share2 = b / 3;
b = share2;
a += share2;
c += share2;
// 3号小朋友分糖果
int share3 = c / 3;
c = share3;
b += share3;
d += share3;
// 4号小朋友分糖果
int share4 = d / 3;
d = share4;
c += share4;
e += share4;
// 5号小朋友分糖果
int share5 = e / 3;
e = share5;
a += share5;
d += share5;
cout << a << " " << b << " " << c << " " << d << " " << e << endl;
return 0;
}
/**************************************************************
Problem: 1032
User: fandaohan
Language: C++
Result: Accepted
Time:16 ms
Memory:2072 kb
****************************************************************/