f=lambda(a,b,c,d):d*2-c if d-c==b-a else d*b/a or b and d/(a/b)
for test in input():
	print test, f(test)