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

#SP0000043. Tìm số nguyên tố trên đoạn (Primes in an Interval)

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ố trên đoạn (Primes in an Interval)

Primes in an Interval

Source: LQDOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given integers A≤BA\le B, find all primes in the inclusive interval [A,B][A,B]. Print the prime numbers in increasing order, one per line.

Input

One line containing two space-separated integers AA and BB.

Output

Print the primes in [A,B][A,B], one per line, in increasing order. Print no numbers if none exist.

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≤100000001\le A\le B\le 10000000.

Examples

Input

1 10

Output

2
3
5
7

Explanation

Within [1,10][1,10], only 2,3,5,72,3,5,7 are prime. The number 11 is not prime, while 4,6,8,9,104,6,8,9,10 are composite. Hence there are four output lines.