program T implicit none integer(8)::a,b,c,d,e(9) read(*,*)a,b do c=a,b-a+1 do d=1,9,1 e(d)=10**d if(mod(c,3)==0)then write(*,*)c cycle else if(mod(c,10)==3)then write(*,*)c cycle else if(int(c/e(d))==3)then write(*,*)c cycle end if end do end do end program T