#SP0000006. Lời tiên đoán của Panoramix (Panoramix's Prediction)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Lời tiên đoán của Panoramix (Panoramix's Prediction)
Panoramix's Prediction
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Panoramix has predicted trouble if the Gauls defeat a prime number of Roman soldiers on one day and the next prime number of soldiers the following day. Yesterday they defeated soldiers, where is prime; today they defeated . Determine whether is the smallest prime strictly greater than .
Input
One line containing two integers and , in that order.
Output
Print YES if is the next prime after ; otherwise print NO. Both words must be uppercase.
Subtasks
- Subtask 1 (20 points): ; is prime.
- Subtask 2 (30 points): ; is prime.
- Subtask 3 (50 points): ; is prime.
Examples
Input
3 5
Output
YES
Explanation
The input is and . The first prime strictly greater than 3 is 5. Thus the answer is YES.
Input
7 11
Output
YES
Explanation
The input is and . The first prime strictly greater than 7 is 11. Thus the answer is YES.
Input
7 9
Output
NO
Explanation
The input is and . The first prime strictly greater than 7 is 11. Thus the answer is NO.