#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e;
int main(){
	cin>>a>>b>>c>>d>>e;
    a=a-a%3;  a/=3; e=e+b; b=b+a;
    b=b-b%3;   b/=3; a=a+b; c=c+b;
    c=c-c%3;  c/=3; b=b+c; d=d+c;
    d=d-d%3;  d/=3; c=c+d; e=e+d;
	e=e-e%3;  e/=3; d=d+e; a=a+e;
    cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
	return 0;
}
/**************************************************************
	Problem: 1032
	User: zhangziang
	Language: C++
	Result: Wrong Answer
****************************************************************/