import java.util.Scanner; public class no207 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); for (; b>=a; a++) { if (String.valueOf(a).contains("3") || a % 3 == 0) { System.out.println(a); } } } }