#include <iostream>
using namespace std;

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

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

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

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

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

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

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

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