#include <iostream>
#include <cmath>
using namespace std;
int main()
{ int t;
int x;
int y;
int z;
int a;
while(x ,y ,z ,a >0)
{
cin >> x;
cin >> y ;
cin >> z ;
cin >> a;
if (y/x == z/y == a/z && y%x == z%y== a%z== 0)
{
int b= a*(y/x);
cout << x << y << z << a << b << endl;
}
if (y-x == z-y == a-z)
{
int b=a+(a-z);
cout << x << y << z << a << b ;
}
else
{
cout << "this is wrong" << endl;
}
}
system ("pause");
return 0 ;
}