using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoder_207 { class Program { static void Main(string[] args) { string[] n = Console.ReadLine().Split(' '); int a = int.Parse(n[0]); int b = int.Parse(n[1]); for (int i = a; i <= b; i++) { if (i % 3 == 0 || i % 10 == 3||i/10==3) { Console.WriteLine(i); } else { int q = 0; int[] s = new int[9]; for (int p = 1; p <= 9; p++) { s[p - 1] = i % (int)Math.Pow(p, 10); } for (int r = 1; r <= 9; r++) { if (s[r - 1] / (int)Math.Pow(r, 10)==3) { q++; } } if (q > 0) { Console.WriteLine(i); } } } Console.ReadLine(); } } }