integer::i,j,n,m,diff 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 do i=n,m if (mod(i,3).eq.0) then print '(i0)',i cycle end if diff = i do while(diff.gt.0) if (mod(diff,10).eq.3) then print '(i0)',i exit end if diff = diff/10 end do end do end