#55408: c++


61247091s@gapps.ntnu.edu.tw (wei)


#include <bits/stdc++.h>
using namespace std;

int main(){
    int f,s,t,hit;
    cin>>f>>s>>t>>hit;
    if(hit==0)cout<<0<<"\n"<<f<<" "<<s<<" "<<t<<"\n";
    else if (hit==1)cout<<f<<"\n"<<s<<" "<<t<<" 1\n";
    else if (hit==2)cout<<f+s<<"\n"<<t<<" 1 0\n";
    else if (hit==3)cout<<f+s+t<<"\n"<<"1 0 0\n";
    else if (hit==4)cout<<f+s+t+1<<"\n"<<"0 0 0\n";
    return 0;
}