P23697 [AtCoder] [ABC011C] 123 Subtraction
普及
题目描述

Problem Description

You have been introduced to a single-player game by a friend.

Initially, a number $ N $ is given. You can choose any number from $ 1 $, $ 2 $, or $ 3 $ and perform subtraction on the given number.

This process can be done up to $ 100 $ times, and the goal of the game is to reduce the number to $ 0 $.

However, there are three NG numbers that must not be reached during the calculation. If the number becomes one of these NG numbers, even temporarily, the game is considered failed. If $ N $ is the same as any of the NG numbers, the game also fails.

There was an incorrect judgment regarding the case where $ N $ is the same as an NG number. A rejudge has been performed.

You want to determine if this game is achievable.

Output YES if the goal is achievable, otherwise output NO.

Input Format

The input is given from the standard input in the following format:

$ N $ $ NG_1 $ $ NG_2 $ $ NG_3 $

  • The first line contains the initial number $N\ (1\ ≦\ N\ ≦\ 300)$.
  • The second line contains the first NG number $NG_1\ (1\ ≦\ NG_1\ ≦\ 300)$.
  • The third line contains the second NG number $NG_2\ (1\ ≦\ NG_2\ ≦\ 300)$.
  • The fourth line contains the third NG number $NG_3\ (1\ ≦\ NG_3\ ≦\ 300)$.

Output Format

Output YES if the goal is achievable, otherwise output NO. Ensure a newline at the end of the output.

Sample Input and Output

Sample Input #1

2
1
7
15

Sample Output #1

YES

Sample Input #2

5
1
4
2

Sample Output #2

YES

Sample Input #3

300
57
121
244

Sample Output #3

NO

Notes/Hints

Sample Explanation 1

You can make $ 0 $ by subtracting $ 2 $ once.

Sample Explanation 2

By subtracting $ 2 $ first and then $ 3 $, the number changes from $ 5 $ to $ 3 $ to $ 0 $, achieving the goal.

Sample Explanation 3

You cannot achieve the goal without subtracting $ 3 $ continuously for $ 100 $ times. However, if you only subtract $ 3 $, you will encounter the NG number $ 57 $ during the process.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 1 7 15
样例输出
YES