#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
int x = 0;
x = a / 3;
a /= 3;
b += x;
e += x;
x = b / 3;
b /= 3;
a += x;
c += x;
x = c / 3;
c /= 3;
b += x;
d += x;
x = d / 3;
d /= 3;
c += x;
e += x;
x = e / 3;
e /= 3;
a += x;
d += x;
printf("%5d%5d%5d%5d%5d", a, b, c, d, e);
return 0;
}