P27752 [洛谷] 【MX-J2-T0】Turtle and Equations
普及-
题目描述

Problem Description

You are given four positive integers \(a, b, c, d\).

You have an equation \((a \ \Box\ b) \ \Box\ c\). You need to determine if it is possible to fill in the two boxes with one of the three operators \(+, -, \times\) (operators can be reused) such that the result of the equation equals \(d\).

Input Format

The first line contains four positive integers \(a, b, c, d\).

Output Format

If it is possible to make the result equal to \(d\), output Yes; otherwise, output No.

Sample Input and Output

Sample Input #1

1 1 1 3

Sample Output #1

Yes

Sample Input #2

5 2 9 27

Sample Output #2

Yes

Sample Input #3

1 1 4 514

Sample Output #3

No

Notes

Sample Explanation #1

Since \((1 + 1) + 1 = 3\), you can fill the first box with \(+\) and the second box with \(+\).

Sample Explanation #2

Since \((5 - 2) \times 9 = 27\), you can fill the first box with \(-\) and the second box with \(\times\).

Sample Explanation #3

No matter what operators are used, the result cannot be \(514\).

Data Range

For all data, \(1 \le a, b, c \le 10\) and \(1 \le d \le 1000\).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 1 1 3
样例输出
Yes