Consider a pair of integers, (a, b). The following operations can be performed on (a, b) in any order, zero or more times:

  • (a, b) -> (a + b, b)
  • (a, b) -> (a, a + b)

For example, starting with (1, 1) perform the operation (1, 1 + 1) to get (1, 2) perform the operation (1 + 2, 2) to get (3, 2), and perform the oepration (3 + 2, 2) to get (5, 2). Alternatively, the first operation could be (1 + 1, 1) to get (2, 1) and so on. The diagram below demonstrates the example representing the pairs as Cartesian coordinates: see image.

Function Description

Complete the function isPossible in the editor below. The function must return a string that denotes whether or not you can convert (a, b) to (c, d) by performing zero or more of the operations specified above. If it is possible, return the string Yes. Otherwise, return No.

isPossible has the following parameter(s):

a: an integer
b: an integer
c: an integer
d: an integer

Constraints

1 <= a, b, c, d <= 1000

Input Format for Custom Testing

Input from stdin will be processed as follows and passed to the function.

  • The first line contains an integer a.
  • The next line contains an integer b.
  • The next line contains an integer c.
  • The next line contains an integer d.

Sample Case 0

Sample input 0

1
4
5
9

Sample Output 0

Yes

Explanation 0

Figure: see image.

Convert (1, 4) to (5, 9) by performing the following sequence of operations: (1, 4) -> (5, 4) -> (5, 9)

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.