using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Application { class MainClass { public static void Main(string[] args) { new MainClass().Calc(); } public MainClass() { } public void Calc () { var scan = new Scanner (); var AB = scan.NextDigits (2); for (var i = AB[0]; i <= AB[1]; i++) { if (i %3 == 0) Console.WriteLine(i); else if(i.ToString().Contains("3")){ Console.WriteLine(i); } } } void WriteLine(object o) { System.Console.WriteLine(o.ToString()); } void WriteEnum(IEnumerable l) { WriteLine(JoinList(l)); } string JoinList(IEnumerable l) { return string.Join(" ", l.Select(x => x.ToString()).ToArray()); } } class Scanner { public int[] NextDigits(int count) { return Enumerable.Range(0, count) .Select(x => NextDigit()).ToArray(); } public string NextToken() { int i; var r = new List(); while ((i = System.Console.Read()) >= 0) { var c = Convert.ToChar(i); if (IsSpace(c) && r.Count > 0) break; r.Add(c); } return new string(r.ToArray()); } bool IsSpace(char c) { if (char.IsWhiteSpace(c)) return true; return false; } public int NextDigit() { var token = NextToken(); return int.Parse(token); } } class Reader { public string Item() { return Items()[0]; } public String[] Items() { return this.Items(' '); } public String[] Items(char c) { return System.Console.ReadLine().Split(c); } public int Int() { return Ints(' ')[0]; } public int[] Ints() { return this.Ints(' '); } public int[] Ints(char c) { return Items(c).Select(x => int.Parse(x)).ToArray(); } } }