	byte a(48,48),b(48*6),c(96,96)
	open(1,file='/usr/lib/han.48',status='old',access='direct',
     *       recl=48*6)
	call pgbegin(0,'/xw',2,2)
10	write(*,*)' input num'
	read(*,*)m
	read(1,rec=m)b
	call expand(a,b)
	do 15 i=1,96
	do 15 j=1,96
15	c(i,j)=0
        do 16 i=1,48
	do 16 j=1,48
16	c(i*2-1,j*2-1)=a(i,j)	
	call display(c)
	do 17 i=2,95,2
	do 17 j=1,95
17	if(c(i-1,j).eq.1.and.c(i+1,j).eq.1)c(i,j)=1
	do 18 i=1,95
	do 18 j=2,95,2
18	if(c(i,j-1).eq.1.and.c(i,j+1).eq.1)c(i,j)=1
	call display(c)
	call add(c)
	call display(c)
	goto 10
	end

	subroutine add(c)
	byte c(96,96),a(96,96)
	do 5 i=1,96
	do 5 j=1,96
5	a(i,j)=c(i,j)
	do 10 i=2,94
	do 10 j=2,94
	if(a(i,j).eq.1)goto 10
	k=a(i-1,j)+a(i+1,j)+a(i,j-1)+a(i,j+1)
	if(k.eq.2)c(i,j)=1
10	continue	
	end

	subroutine display(c)
	byte c(96,96)
	call pgenv(0.,99.,99.,0.,0,0)
	do 20 i=1,95
	do 20 j=1,95
20	if(c(i,j).ne.0) call pgpoint(1,float(i),float(j),-1)
	end

	subroutine expand(a,b)
	byte a(48,48),b(48,6)
        integer b8(8)
        data b8/128,64,32,16,8,4,2,1/
	do 5 i=1,48
	do 5 j=1,48
5	a(i,j)=0
        do 10 j=1,48
        l=0
        do 10 i=1,6
        m=b(j,i)
        if(m.lt.0)m=m+256
        do 10 k=1,8
        l=l+1
        if(iand(m,b8(k)).ne.0)a(l,j)=1
10      continue
	end
