PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000111. Dãy bán nguyên tố chẵn dài nhất (Even Semiprime Runs)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Dãy bán nguyên tố chẵn dài nhất (Even Semiprime Runs)

Even Semiprime Runs

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

A semiprime is a positive integer that is a product of exactly two primes, which may be equal. Examples include 4=2⋅24=2\cdot2, 9=3⋅39=3\cdot3, and 15=3⋅515=3\cdot5. List all semiprimes of the inclusive interval [N,M][N,M] in increasing order. A run is a contiguous subsequence of this semiprime list: its numerical values need not be consecutive integers. An even run contains only even semiprimes. Find the longest even run; if several qualify, choose the one with the smallest first member. It is guaranteed that at least one even semiprime is present in the interval.

Input

One line contains integers N,MN,M.

Output

Print two lines: the length of the chosen run, then its members in increasing order separated by single spaces.

Subtasks

  • Subtask 1 (20 points): 1≤N≤M≤1000001\le N\le M\le 100000; 0≤M−N≤20000\le M-N\le 2000; at least one even semiprime lies in the interval.
  • Subtask 2 (30 points): 1≤N≤M≤10000000001\le N\le M\le 1000000000; 0≤M−N≤1000000\le M-N\le 100000; at least one even semiprime lies in the interval.
  • Subtask 3 (50 points): 1≤N≤M≤1000000000000001\le N\le M\le 100000000000000; 0≤M−N≤100000000\le M-N\le 10000000; at least one even semiprime lies in the interval.

Examples

Input

1 1000

Output

3
454 458 466

Explanation

454=2⋅227454=2\cdot227, 458=2⋅229458=2\cdot229, and 466=2⋅233466=2\cdot233 are all even semiprimes. No other semiprime occurs between successive members of this run, so they form a contiguous run of length 33 in the semiprime list. There is no longer even run in [1,1000][1,1000].