#include<bits/stdc++.h>
using namespace std;
struct stu{
string name;
int jin;
int yin;
int tong;
}a[110];
int main(){
int n;
cin>>n;
for (int i = 0; i < n; ++i) {
cin >> a[i].name >> a[i].jin >> a[i].yin >> a[i].tong;
int z = a[i].jin + a[i].yin + a[i].tong;
cout << a[i].name << " " << a[i].jin << " " << a[i].yin << " " << a[i].tong << " " << z <<endl;
}
return 0;
}