#include <stdio.h>

char TypeFormat[]="%d";
typedef int Type;

typedef Type V3D[3];
typedef Type M3D[3][3];

void PrintV3D(V3D U,char C[]);
void PrintM3D(M3D A,char C[]);
void ProdM3DV3D(M3D A, V3D x, V3D y);

int main(){ 
  M3D A={{1,2,3},{4,5,6},{7,8,9}};
  V3D x={1,1,1},y;
  PrintM3D(A,"A");
  PrintV3D(x,"x");
  ProdM3DV3D(A,x,y);
  PrintV3D(y,"y=A*x");
  return 1;
}

void PrintV3D(V3D U,char C[]){
  printf("%s=[",C);
  printf(TypeFormat,U[0]);
  printf(", ");
  printf(TypeFormat,U[1]);
  printf(", ");
  printf(TypeFormat,U[2]);
  printf("]\n");
}

void PrintM3D(M3D A,char C[]){
  int i;
  printf("%s=[\n",C);
  for (i=0;i<3;i++){
    printf("  [");
    printf(TypeFormat,A[i][0]);
    printf(", ");
    printf(TypeFormat,A[i][1]);
    printf(", ");
    printf(TypeFormat,A[i][2]);
    printf("]\n");
  }
  printf("]\n");
}

void ProdM3DV3D(M3D A, V3D x, V3D y){
  Type S;
  int i,k;
  for (i=0;i<3;i++){
    S=0;
    for (k=0;k<3;k++)
      S+=A[i][k]*x[k];
    y[i]=S;
  }
}
