	.EQU	@,$000
	.EQU	M,3
	.EQU	N,4

	CLR	i
for1:	LDA	i
	CMA#	M
	JGE	next1

	CLR	j
for2:	LDA	j
	CMA#	N
	JGE	next2

	LDA	i
	MUL#	N
	ADA	j
	TAX			; ACC->XR
	JSR	GET_NUM
	STA+	a

	INC	j
	JMP	for2
	
next2:	INC	i
	JMP	for1

next1:	JSR	GET_NUM
	STA	c1
	JSR	GET_NUM
	STA	c2

	CLR	i
for3:	LDA	i
	CMA#	M
	JGE	next3

	LDA	i
	MUL#	N
	ADA	c1
	TAX
	LDA+	a
	MUL#	2

	STA	t

	LDA	i
	MUL#	N
	ADA	c2
	TAX
	LDA+	a
	ADA	t
	STA+	a
	
	INC	i
	JMP	for3
	
next3:	JSR	PUT_NL

	CLR	i
for4:	LDA	i
	CMA#	M
	JGE	next4

	CLR	j
for5:	LDA	j
	CMA#	N
	JGE	next5

	LDA	i
	MUL#	N
	ADA	j
	TAX

	LDA+	a

	JSR	PUT_NUM2
	LDA#	' '
	JSR	PUT_CHR
	
	INC	j
	JMP	for5

next5:	JSR	PUT_NL
	INC	i
	JMP	for4
next4:	HLT
	
	 
i:	.WORD
j:	.WORD
t:	.WORD
c1:	.WORD
c2:	.WORD
a:	.BLKW	M*N

	.END