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

#SP0000261. Các số nguyên tố giả (Phony Primes)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Các số nguyên tố giả (Phony Primes)

Phony Primes

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer interval [L,R][L,R], an integer xx in this interval is called a phony prime if all of the following hold:

  • xx is odd.
  • xx is a product of at least three distinct primes, each appearing exactly once: x=p1p2⋯pkx=p_1p_2\cdots p_k with k≥3k\ge3.
  • For each prime divisor pip_i of xx, (pi−1)(p_i-1) divides (x−1)(x-1).

For example, 561=3⋅11⋅17561=3\cdot11\cdot17 and 560560 is divisible by 2,10,162,10,16, so 561561 is valid. List every valid number in [L,R][L,R] in increasing order.

Input

One line containing the two integers LL and RR.

Output

Print each phony prime in [L,R][L,R] on a separate line, in increasing order. If none exists, print exactly none in lowercase.

Subtasks

  • Subtask 1 (20 points): 1≤L<R<2311\le L<R<2^{31}; 1≤R−L≤10001\le R-L\le 1000.
  • Subtask 2 (30 points): 1≤L<R<2311\le L<R<2^{31}; 1≤R−L≤500001\le R-L\le 50000.
  • Subtask 3 (50 points): 1≤L<R<2311\le L<R<2^{31}; 1≤R−L≤9999991\le R-L\le 999999.

Examples

Example 1

Input

10 2000

Output

561
1105
1729

Explanation

The qualifying integers are 561=3⋅11⋅17561=3\cdot11\cdot17, 1105=5⋅13⋅171105=5\cdot13\cdot17, and 1729=7⋅13⋅191729=7\cdot13\cdot19. For 561561, the number 560560 is divisible by 2,10,162,10,16; for 11051105, the number 11041104 is divisible by 4,12,164,12,16; and for 17291729, the number 17281728 is divisible by 6,12,186,12,18. Each is odd and is a product of three distinct primes. Checking the remaining numbers in the interval yields no other valid integer. Print the three answers in increasing order.

Example 2

Input

20000 21000

Output

none

Explanation

No integer in this interval satisfies every required condition, so print none.