#include <stdio.h>
using namespace std;
class Matric{
public:
Matric(int _p1, int _p2, int _p3, int _p4){
p1 = _p1;
p2 = _p2;
p3 = _p3;
p4 = _p4;
};
Matric(const Matric &m){
p1 = m.p1;
p2 = m.p2;
p3 = m.p3;
p4 = m.p4;
};
Matric operator*(const Matric &m){
int _p1 = p1 * m.p1 + p2 * m.p3;
int _p2 = p1 * m.p2 + p2 * m.p4;
int _p3 = p3 * m.p1 + p4 * m.p3;
int _p4 = p3 * m.p2 + p4 * m.p4;
Matric res(_p1, _p2, _p3, _p4);
return res;
}
int p1;
int p2;
int p3;
int p4;
};
int main(){
Matric m1(1, 2, 3, 4);
Matric m2(1, 0, 1, 0);
Matric m = m1 * m2;
printf("%d %d \n%d %d\n", m.p1, m.p2, m.p3, m.p4);
return 0;
}