#include<iostream>using namespace std;int main(){ int a,b,c,d,e,t; cin>>t; while((0<=t)and(t<=20)) { cin>>a>>b>>c>>d; if(b-a==c-b) { e=b-a+d; } else { e=b/a*d; } cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;} return 0;}