import sys input = sys.stdin.readline a,b=map(int,input().split()) c,d=map(int,input().split()) # 行列の計算 def prod(A,B,k,l,m):# A:k*l,B:l*m C=[[None for i in range(m)] for j in range(k)] for i in range(k): for j in range(m): ANS=0 for pl in range(l): ANS=(ANS+A[i][pl]*B[pl][j]) C[i][j]=ANS return C A=[[a,b],[c,d]] B=prod(A,A,2,2,2) C=prod(B,A,2,2,2) print(*C[0]) print(*C[1])