#include using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } using V = array; using Mat = array; Mat mul(Mat a, Mat b) { Mat c = Mat{V{0, 0}, V{0, 0}}; for (int i = 0; i < 2; i++) { for (int k = 0; k < 2; k++) { for (int j = 0; j < 2; j++) { c[i][j] += a[i][k] * b[k][j]; } } } return c; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); Mat A, B; for (int s : {0, 1}) { for (int t : {0, 1}) cin >> A[s][t]; } for (int s : {0, 1}) { for (int t : {0, 1}) cin >> B[s][t]; } auto C = mul(A, B); C = mul(C, C); for (int s : {0, 1}) { for (int t : {0, 1}) cout << C[s][t] << " \n"[t]; } }