using System; using System.Collections.Generic; using System.Linq; namespace prob207 { class Program { static void Main(string[] args) { long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); if ((a[1]-a[0])<=0 || (a[1]-a[0]>100)) { Environment.Exit(0); } for (long i = a[0]; i < a[1]+1; i++) { Check(i); } } private static void Check(long i) { long c = i; List b = new List(); while (i>0) { b.Add((int)(i % 10)); i = i / 10; } // 3の倍数かの判定 if (b.Sum() % 3 == 0) { Console.WriteLine(c); } // 3のつく数か else if (b.Contains(3)) { Console.WriteLine(c); } } } }