int main(){
    int d,n;
    scanf("%d%d",&n,&d);
    
    if(d==1){
            int sz[9][9]= {{0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0},
                       {0,0,0,1*n,1*n,1*n,0,0,0},
                       {0,0,0,1*n,2*n,1*n,0,0,0},
                       {0,0,0,1*n,1*n,1*n,0,0,0},
                       {0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0}};
    int i,j;
        for(i=0;i<9;i++){
                     for(j=0;j<8;j++){
                                      printf("%d ",sz[i][j]);
                                    
                                     
                                      }
                     printf("%d\n",sz[i][8]);
                     }
        }
    if(d==2){
             int sz[9][9]={{0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0},
                       {0,0,1*n,2*n,3*n,2*n,1*n,0,0},
                       {0,0,2*n,6*n,8*n,6*n,2*n,0,0},
                       {0,0,3*n,8*n,12*n,8*n,3*n,0,0},
                       {0,0,2*n,6*n,8*n,6*n,2*n,0,0},
                       {0,0,1*n,2*n,3*n,2*n,1*n,0,0},
                       {0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0}};
                       int i,j;
    for(i=0;i<9;i++){
                     for(j=0;j<8;j++){
                                      printf("%d ",sz[i][j]);
                                    
                                     
                                      }
                     printf("%d\n",sz[i][8]);
                     }
             }
             
    if(d==3){
             int sz[9][9]={{0,0,0,0,0,0,0,0,0},
                       {0,1*n,3*n,6*n,7*n,6*n,3*n,1*n,0},
                       {0,3*n,12*n,24*n,30*n,24*n,12*n,3*n,0},
                       {0,6*n,24*n,51*n,63*n,51*n,24*n,6*n,0},
                       {0,7*n,30*n,63*n,80*n,63*n,30*n,7*n,0},
                       {0,6*n,24*n,51*n,63*n,51*n,24*n,6*n,0},
                       {0,3*n,12*n,24*n,30*n,24*n,12*n,3*n,0},
                       {0,1*n,3*n,6*n,7*n,6*n,3*n,1*n,0},
                       {0,0,0,0,0,0,0,0,0}};
                       int i,j;
    for(i=0;i<9;i++){
                     for(j=0;j<8;j++){
                                      printf("%d ",sz[i][j]);
                                    
                                     
                                      }
                     printf("%d\n",sz[i][8]);
                     }
             }
             
    if(d==4){
            int sz[9][9]={{1*n,4*n,10*n,16*n,19*n,16*n,10*n,4*n,1*n},
                       {4*n,20*n,52*n,88*n,104*n,88*n,52*n,20*n,4*n},
                       {10*n,52*n,142*n,244*n,292*n,244*n,142*n,52*n,10*n},
                       {16*n,88*n,244*n,428*n,512*n,428*n,244*n,88*n,16*n},
                       {19*n,104*n,292*n,512*n,616*n,512*n,292*n,104*n,19*n},
                       {16*n,88*n,244*n,428*n,512*n,428*n,244*n,88*n,16*n},
                       {10*n,52*n,142*n,244*n,292*n,244*n,142*n,52*n,10*n},
                       {4*n,20*n,52*n,88*n,104*n,88*n,52*n,20*n,4*n},
                       {1*n,4*n,10*n,16*n,19*n,16*n,10*n,4*n,1*n}};
                       int i,j;
    for(i=0;i<9;i++){
                     for(j=0;j<8;j++){
                                      printf("%d ",sz[i][j]);
                                    
                                     
                                      }
                     printf("%d\n",sz[i][8]);
                     }
             }
             

        return 0;
}