#include <iostream>
using namespace std;

int main() {
    int a, b, c, d, e;
    // 输入五个小朋友初始的糖果数
    cin >> a >> b >> c >> d >> e;

    // 1号小朋友分糖果
    int give = a / 3;
    a = give;
    b += give;
    e += give;

    // 2号小朋友分糖果
    give = b / 3;
    b = give;
    a += give;
    c += give;

    // 3号小朋友分糖果
    give = c / 3;
    c = give;
    b += give;
    d += give;

    // 4号小朋友分糖果
    give = d / 3;
    d = give;
    c += give;
    e += give;

    // 5号小朋友分糖果
    give = e / 3;
    e = give;
    a += give;
    d += give;

    // 输出一轮后每个小朋友手上的糖果数
    cout << a << " " << b << " " << c << " " << d << " " << e << endl;

    return 0;
}
/**************************************************************
	Problem: 1032
	User: linzihang
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/