import numpy as np #np.set_printoptions(precision=10, floatmode='maxprec') #original = np.array([[1, 0], [0, 1]]) N1, N2 = map(int, input().split()) N3, N4 = map(int, input().split()) M = np.array([[N1, N2], [N3, N4]]) ans = np.linalg.matrix_power(M, 3) print(*ans[0]) print(*ans[1])