import std; void main () { int[][] M = new int[][](2, 0); foreach (i; 0..2) { M[i] = readln.split.to!(int[]); } int a = M[0][0], b = M[0][1], c = M[1][0], d = M[1][1]; writeln(a^^3+2*a*b*c+b*c*d, " ", a^^2*b+b^^2*c+a*b*d+b*d^^2); writeln(a^^2*c+a*c*d+b*c^^2+c*d^^2, " ", a*b*c+b*c*d+b*c*d+d^^3); }