A,B = map(int,input().split()) Num = A while Num <= B: if (Num % B ==0): print(Num) elif ("3" in str(Num)): print(Num) Num += 1