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

#SP0000044. Tìm số nguyên tố (Prime Numbers in a Range)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tìm số nguyên tố (Prime Numbers in a Range)

Prime Numbers in a Range

Source: VNOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Two integers A,BA,B determine an inclusive range [A,B][A,B]. Output every prime in this range in ascending order. A prime must be greater than 11 and have no positive divisors other than 11 and itself.

Input

One line containing two integers AA and BB.

Output

Print each prime in [A,B][A,B] on its own line in increasing order.

Subtasks

  • Subtask 1 (20 points): 1≤A≤B≤1001\le A\le B\le 100.
  • Subtask 2 (30 points): 1≤A≤B≤200001\le A\le B\le 20000.
  • Subtask 3 (50 points): 1≤A≤B≤2000001\le A\le B\le 200000.

Examples

Input

1 10

Output

2
3
5
7

Explanation

The integers from 11 to 1010 include exactly four primes: 2,3,5,72,3,5,7. Since each is printed on its own line, the output consists of four lines.