import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(), b = sc.nextInt(), t, s; for(int i = a; i <= b; i++){ s = 0; t = i; while(t > 0){ if(t%10 == 3){ break; } s += t%10; t/=10; } if(t > 0 || s % 3 == 0){ System.out.println(i); } } } }