import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int K=sc.nextInt(); int N = sc.nextInt(); boolean[] nera = new boolean[N+1]; Arrays.fill(nera, true); for(int i=2;i*i<=N;i++){ if(nera[i]){ for(int j=i*2;j<=N;j+=i){ if(nera[j])nera[j]=false; } } } ArrayList ha = new ArrayList<>(); for(int i=K;i<=N;i++){ if(nera[i]){ System.out.print(i); int temp=i; while(temp>9){ int temp2=temp; temp=0; while(temp2!=0){ temp+=temp2%10; temp2=temp2/10; } } ha.add(temp); } } System.out.println(""); for(int a:ha){ System.out.print(a+" "); } } }