# Read the input matrix elements a, b = map(int, input().split()) c, d = map(int, input().split()) # Calculate M squared elements e = a * a + b * c f = a * b + b * d g = c * a + d * c h = c * b + d * d # Calculate M cubed elements i = e * a + f * c j = e * b + f * d k = g * a + h * c l = g * b + h * d # Output the result print(i, j) print(k, l)