print(input())
 
x, y, z = [int(x) for x in input().split()]
for i in range(1, 5):
    print("{0} {1} {2} {3}".format(i, i**x, i**y, i**z))