character*32::str(100) character*32::num integer::i,j,n,m,diff,index data str/100*''/ read *,n,m diff = (m-n)/1000 do while(diff.gt.0) if (mod(diff,10).eq.3) then print '(i0)',(i,i=n,m) return end if diff = diff/10 end do index=1 do i=n,m if (mod(i,3).eq.0) then write(num,*),i str(index)=adjustl(num) index=index+1 cycle end if diff = i do while(diff.gt.0) if (mod(diff,10).eq.3) then write(num,*),i str(index)=adjustl(num) index=index+1 exit end if diff = diff/10 end do end do print '(a)',(str(i),i=1,index-1) end