Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Mr. Pr and Ms. Ad are at a and b respectively on an infinite number line. Mr. Pr wants to meet Ms. Ad. Mr. Pr

Mr. Pr and Ms. Ad are at a and b respectively on an infinite number line. Mr. Pr wants to meet Ms. Ad.

Mr. Pr can choose to move c or d units in 1 second. If Mr. Pr moves c units then Ms. Ad will move d units and vice versa. (Both of them always moved in positive x-direction).

You have to determine if Mr. Pr can meet with Ms. Ad after some integral amount of time, given that Mr. Pr chooses optimally. Note that meeting after a fractional amount of time does not count.

Constraints

1a,b,c,d109

Input Format

Four space separated integers, a, b, c, and d.

Output Format

Output a single line containing "YES" if Mr. Pr meets with Ms. Ad, otherwise "NO".

Sample #1

Input

3 4 1 2

Output

YES

Explanation

Mr. Pr will move 2 units in the first second

and Ms. Ad moves 1 unit simultaneously

and they meet.

Sample #2

Input

10 20 3 7

Output

NO

Explanation

It is impossible to meet

(fractional time is not allowed)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago