a=list(map(int,input().split(' '))) res=0 for i in range(len(a)): res+=a[i]%3 t=a[i]//3 a[i]//=3 a[i-1]+=t a[(i+1)%len(a)]+=t print(*a) print(res)