You are choreographing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity). 

The first kangaroo starts at location $x\mbox{1}$ and moves at a rate of $\mbox{v1}$ meters per jump. 
The second kangaroo starts at location $x2$ and moves at a rate of $v2$ meters per jump.

You have to figure out a way to get both kangaroos at the same location at the same time  as part of the show.  If it is possible, return YES, otherwise return NO.  

Example 

$x1=2$ 

$v1=1$ 

$x2=1$ 

$v2=2$   

After one jump, they are both at $x=3$, ($x1+v1=2+1$, $x2+v2=1+2$), so the answer is YES.

Function Description

Complete the function kangaroo in the editor below.    

kangaroo has the following parameter(s):  

int x1, int v1: starting position and jump distance for kangaroo 1
int x2, int v2: starting position and jump distance for kangaroo 2   

Returns   

string: either YES or NO

Input Format

A single line of four space-separated integers denoting the respective values of $x\mbox{1}$, $\mbox{v1}$, $x2$, and $v2$.

Constraints

$0\leq x1<x2\leq10000$  
$1\leq v1\leq10000$  
$1\leq v2\leq10000$  

Sample Input 0
0 3 4 2

Sample Output 0
YES

Explanation 0

The two kangaroos jump through the following sequence of locations:

From the image, it is clear that the kangaroos meet at the same location (number $12$ on the number line) after same number of jumps ($\begin{array}{c}4\end{array}$ jumps), and we print YES.

Sample Input 1
0 2 5 3

Sample Output 1
NO

Explanation 1

The second kangaroo has a starting location that is ahead (further to the right) of the first kangaroo's starting location (i.e., $x_2>x_1$). Because the second kangaroo moves at a faster rate (meaning $v_2>v_1$) and is already ahead of the first kangaroo, the first kangaroo will never be able to catch up. Thus, we print NO.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
(a, b, c, d) = map(int, input().split(' '))
if a - c == 0:
	print('YES')
	quit()
if d - b == 0:
	print('NO')
	quit()
if (a - c) % (d - b) == 0 and (a - c) // (d - b) >= 0:
	print('YES')
	quit()
print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
found = False
for i in range(10000):
	if x1 + v1 * i == x2 + v2 * i:
		print('YES')
		found = True
		break
if not found:
	print('NO')


(x1, v1, x2, v2) = map(int, input().split())
if x1 > x2:
	if v2 > v1 and (x1 - x2) % (v2 - v1) == 0:
		print('YES')
	else:
		print('NO')
elif x1 < x2:
	if v1 > v2 and (x2 - x1) % (v1 - v2) == 0:
		print('YES')
	else:
		print('NO')
else:
	print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
exist = False
while True:
	if x1 == x2:
		exist = True
		break
	if v1 > v2 and x1 > x2 or (v2 > v1 and x2 > x1) or (v2 == v1 and x2 != x1):
		break
	x1 += v1
	x2 += v2
if exist:
	print('YES')
else:
	print('NO')


def solve():
	a = input().strip().split()
	s = []
	for i in a:
		s.append(int(i))
	if s[0] < s[2] and s[1] <= s[3] or (s[0] > s[2] and s[1] >= s[3]):
		print('NO')
		return
	if s[0] < s[2]:
		if (s[2] - s[0]) % (s[1] - s[3]) == 0:
			print('YES')
		else:
			print('NO')
	elif (s[0] - s[2]) % (s[3] - s[1]) == 0:
		print('YES')
	else:
		print('NO')
solve()


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2:
	(x1, x2) = (x2, x1)
	(v1, v2) = (v2, v1)
d = x2 - x1
r = v1 - v2
flag = False
if d == 0:
	flag = True
elif r > 0:
	flag = d % r == 0
else:
	flag = False
if flag:
	print('YES')
else:
	print('NO')


(x1, v1, x2, v2) = [int(x) for x in input().strip().split(' ')]
n = (x1 - x2) / (v2 - v1)
if abs(int(n) - n) < 0.05 and n > 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 == x2:
	print('YES')
elif v1 == v2:
	print('NO')
else:
	t = (x2 - x1) / (v1 - v2)
	if t % 1 == 0 and t > 0:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
x_diff = x1 - x2
v_diff = v1 - v2
if x_diff * v_diff >= 0 or x_diff % v_diff != 0:
	print('NO')
else:
	print('YES')


import sys
(x1, v1, x2, v2) = [int(_) for _ in input().strip().split(' ')]
if v2 >= v1 or (x2 - x1) // (v2 - v1) != (x2 - x1) / (v2 - v1):
	print('NO')
else:
	print('YES')


(x, u, y, v) = map(int, input().split())
print('YES' if u > v and abs(x - y) % abs(u - v) == 0 else 'NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]

def test(x1, v1, x2, v2):
	if v2 >= v1:
		print('NO')
		return
	while x1 < x2:
		x1 += v1
		x2 += v2
		if x1 == x2:
			print('YES')
			return
	print('NO')
	return
test(x1, v1, x2, v2)


(x1, v1, x2, v2) = [int(s) for s in input().split()]
if x1 == x2:
	print('YES')
if x1 > x2:
	(x1, x2, v1, v2) = (x2, x1, v2, v1)
if v1 <= v2:
	print('NO')
else:
	while x1 < x2:
		x1 += v1
		x2 += v2
	if x1 == x2:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 < x2 and v1 > v2:
	while x1 < x2:
		x1 += v1
		x2 += v2
	print(['YES', 'NO'][x1 != x2])
elif x1 > x2 and v1 < v2:
	while x2 < x1:
		x1 += v1
		x2 += v2
	print(['YES', 'NO'][x1 != x2])
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if float(v2 - v1) / (x2 - x1) > 0:
	print('NO')
elif v2 == v1:
	if x2 == x1:
		print('YES')
	else:
		print('NO')
elif abs(x2 - x1) % abs(v2 - v1) != 0:
	print('NO')
else:
	print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
print('YES' if v1 > v2 and (x2 - x1) % (v1 - v2) == 0 else 'NO')


(x1, v1, x2, v2) = map(int, input().split(' '))
print((v2 < v1 and ((x2 - x1) / (v2 - v1)).is_integer()) and 'YES' or 'NO')


(x1, v1, x2, v2) = map(int, input().split())
if v2 >= v1:
	print('NO')
elif (x2 - x1) % (v2 - v1) == 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 - v2 > 0 and (x2 - x1) % (v1 - v2) == 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
ans = 0
if v1 > v2:
	while x1 < x2:
		x1 = x1 + v1
		x2 = x2 + v2
		if x1 == x2:
			ans = 1
if v1 < v2:
	while x1 > x2:
		x1 = x1 + v1
		x2 = x2 + v2
		if x1 == x2:
			ans = 1
if v1 == v2:
	if x1 == x2:
		ans = 1
if ans == 1:
	print('YES')
else:
	print('NO')


import sys

def willmeet(dist, vel):
	if dist == 0:
		return True
	if dist < 0:
		dist = -dist
		vel = -vel
	if vel >= 0:
		return False
	return dist % -vel == 0
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
print('YES' if willmeet(x2 - x1, v2 - v1) else 'NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 != v2:
	n = (x1 - x2) / (v2 - v1)
	if n > 0 and n.is_integer():
		print('YES')
	else:
		print('NO')
elif x1 == x2:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	print('YES' if x1 == x2 else 'NO')
else:
	dx = x2 - x1
	dv = v1 - v2
	n = dx / dv
	print('YES' if n >= 0 and dx % dv == 0 else 'NO')


import sys

def main():
	(x1, v1, x2, v2) = input().strip().split(' ')
	(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
	if v2 >= v1:
		print('NO')
		return
	while x1 < x2:
		x1 += v1
		x2 += v2
		if x1 == x2:
			print('YES')
			return
	print('NO')
main()


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	if x1 == x2:
		print('YES')
	else:
		print('NO')
else:
	dx = x1 - x2
	dv = v1 - v2
	if dx == 0 or (-dx / dv > 0 and dx % dv == 0):
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 <= v2:
	print('NO')
else:
	print('YES' if (x2 - x1) % (v1 - v2) == 0 else 'NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
while (x1 - x2) * (v1 - v2) < 0:
	x1 += v1
	x2 += v2
if x1 == x2:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
ans = 'NO'
if v1 != v2:
	n = (x1 - x2) / (v2 - v1)
	ans = 'YES' if (int(n) == n) & (n >= 0) else 'NO'
else:
	ans = 'YES' if x1 == x2 else 'NO'
print(ans)


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
for _ in range(10000):
	l1 = x1 + v1 * _
	l2 = x2 + v2 * _
	if l1 == l2:
		print('YES')
		break
	if _ == 9999:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
s = 'NO'
if v1 == v2:
	if x1 == x2:
		s = 'YES'
elif (x2 - x1) / (v1 - v2) > 0 and (x2 - x1) % (v1 - v2) == 0:
	s = 'YES'
print(s)


import sys
(x1, v1, x2, v2) = [int(x) for x in input().split(' ')]
if v2 >= v1:
	print('NO')
else:
	while True:
		x1 += v1
		x2 += v2
		if x1 == x2:
			print('YES')
			break
		elif x1 > x2:
			print('NO')
			break


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
d = x2 - x1
if v2 >= v1:
	print('NO')
else:
	n = d / (v1 - v2)
	if n % 1 == 0:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
change = v1 - v2
difference = x1 - x2
if change > 0 and difference > 0:
	print('NO')
elif change == 0 and difference != 0:
	print('NO')
elif change < 0 and difference < 0:
	print('NO')
elif difference % change == 0:
	print('YES')
else:
	print('NO')


import sys

def main():
	(x1, v1, x2, v2) = input().strip().split(' ')
	(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
	if x1 == x2:
		return 'YES'
	if v1 == v2:
		return 'NO'
	if x1 < x2 and v1 < v2:
		return 'NO'
	if x2 < x1 and v2 < v1:
		return 'NO'
	if (x2 - x1) % float(v1 - v2) == 0:
		return 'YES'
	else:
		return 'NO'
print(main())


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2:
	(x1, x2) = (x2, x1)
	(v1, v2) = (v2, v1)
if x1 == x2:
	if v1 == v2:
		print('YES')
	else:
		print('NO')
elif x1 < x2:
	if v1 > v2:
		while x1 < x2:
			x1 += v1
			x2 += v2
		if x1 == x2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


case = [int(n) for n in input().split(' ')]
if case[0] == case[2]:
	print('YES')
elif case[0] > case[2] and case[1] < case[3]:
	if (case[0] - case[2]) % (case[3] - case[1]) == 0:
		print('YES')
	else:
		print('NO')
elif case[0] < case[2] and case[1] > case[3]:
	if (case[2] - case[0]) % (case[1] - case[3]) == 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
first_smaller = False
if x1 <= x2:
	d1 = x1
	d2 = x2
	first_smaller = True
else:
	d1 = x2
	d2 = x1
	first_smaller = False
while d2 > d1:
	if first_smaller:
		if v2 < v1:
			d1 += v1
			d2 += v2
		else:
			break
	elif v1 < v2:
		d1 += v2
		d2 += v1
	else:
		break
if d1 == d2:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 > v2:
	t = 0
	x1_dash = x1
	x2_dash = x2
	while x1_dash < x2_dash:
		x1_dash = x1 + v1 * t
		x2_dash = x2 + v2 * t
		t += 1
	if x1_dash == x2_dash:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
dx = x2 - x1
dv = v1 - v2
print('YES' if dv > 0 and dx % dv == 0 and (dx * dv >= 0) else 'NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2:
	(x1, x2) = (x2, x1)
	(v1, v2) = (v2, v1)
if x1 == x2:
	print('YES')
elif v2 >= v1:
	print('NO')
elif (x2 - x1) % (v1 - v2) == 0:
	print('YES')
else:
	print('NO')


import sys

def meet_check(delx, delv):
	if delv == 0:
		return 'NO'
	intersect = delx / delv
	if intersect > 0 and intersect == int(intersect):
		return 'YES'
	return 'NO'
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
delx = x1 - x2
delv = v2 - v1
print(meet_check(delx, delv))


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 == x2:
	print('YES')
elif x1 > x2 and v2 > v1 and ((x1 - x2) % (v2 - v1) == 0):
	print('YES')
elif x2 > x1 and v1 > v2 and ((x2 - x1) % (v1 - v2) == 0):
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if (x1 < x2) & (v1 <= v2):
	print('NO')
if (x1 > x2) & (v1 >= v2):
	print('NO')
if x1 == x2:
	print('YES')
if (x1 < x2) & (v1 > v2):
	while x1 < x2:
		x1 = x1 + v1
		x2 = x2 + v2
	if x1 == x2:
		print('YES')
	else:
		print('NO')
if (x1 > x2) & (v1 < v2):
	while x2 < x1:
		x2 = x2 + v2
		x1 = x1 + v1
	if x1 == x2:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	if x1 == x2:
		print('YES')
	else:
		print('NO')
elif (x1 - x2) % (v2 - v1) == 0 and (x1 - x2) * (v2 - v1) > 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
steps = 0
if x1 > x2 and v1 >= v2:
	print('NO')
elif x2 > x1 and v2 >= v1:
	print('NO')
else:
	while True:
		x1 += v1
		x2 += v2
		steps += 1
		if x1 == x2:
			print('YES')
			break
		elif x1 > x2 and v1 >= v2:
			print('NO')
			break
		elif x2 > x1 and v2 >= v1:
			print('NO')
			break


(x1, v1, x2, v2) = list(map(int, input().strip().split()))
if v1 <= v2:
	print('NO')
else:
	dX = x2 - x1
	dV = v1 - v2
	if dX % dV == 0:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
coincide = False
while x1 < x2 and v1 > v2 or (x2 < x1 and v2 > v1):
	x1 += v1
	x2 += v2
if x1 == x2:
	coincide = True
if coincide:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	if x1 == x2:
		ans = 'YES'
	else:
		ans = 'NO'
else:
	steps = (x2 - x1) / (v1 - v2)
	ans = 'YES' if steps - int(steps) < 0.001 and steps > 0 else 'NO'
print(ans)


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if not v1 - v2 == 0:
	same_position = (-x1 + x2) / (v1 - v2)
	if same_position > 0 and same_position.is_integer():
		print('YES')
	else:
		print('NO')
elif x1 == x2:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]

def main(x1, v1, x2, v2):
	if v1 == v2:
		if x1 == x2:
			print('YES')
			return
		else:
			print('NO')
			return
	if v1 > v2:
		(v1, v2) = (v2, v1)
		(x1, x2) = (x2, x1)
	assert v2 > v1
	if x1 == x2:
		print('YES')
		return
	if x2 > x1:
		print('NO')
		return
	assert x2 < x1
	if (x1 - x2) % (v2 - v1) == 0:
		print('YES')
		return
	else:
		print('NO')
		return
main(x1, v1, x2, v2)


(x1, v1, x2, v2) = map(int, input().strip().split(' '))
d = x2 - x1
num = v1 - v2
if num <= 0:
	print('NO')
elif d % num == 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
x = x2 - x1
v = v2 - v1
if v == 0:
	print('NO' if x else 'YES')
elif x == 0:
	print('YES')
elif x % v == 0 and x / v < 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = map(int, input().strip().split())
if x1 == x2:
	print('YES')
elif v1 == v2:
	print('NO')
else:
	dx = x1 - x2
	dv = v2 - v1
	if dx / dv == dx // dv and dx // dv >= 0:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
x = x1 - x2
v = v2 - v1
if x == 0:
	print('YES')
elif v == 0:
	print('NO')
else:
	t = x / v
	if t < 0:
		print('NO')
	elif x % v == 0:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	if x1 == x2:
		print('YES')
	else:
		print('NO')
else:
	numer = x1 - x2
	denom = v2 - v1
	answer = float(numer) / float(denom)
	if (answer == int(answer)) & (answer >= 0):
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = map(int, input().strip().split(' '))
dx = x2 - x1
dv = v2 - v1
if dx == 0 or (dv * dx < 0 and dx % dv == 0):
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	print('NO')
elif (x1 - x2) % (v2 - v1) == 0:
	if (x1 - x2) / (v2 - v1) > 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(x1, v1, x2, v2) = [int(i) for i in input().strip().split(' ')]
if v1 == v2:
	if x1 != x2:
		print('NO')
	else:
		print('YES')
else:
	temp = (x1 - x2) / (v2 - v1)
	if temp != int(temp) or temp < 0:
		print('NO')
	else:
		print('YES')


import sys

def catch_up(left_position, left_speed, right_position, right_speed):
	while left_position < right_position:
		left_position += left_speed
		right_position += right_speed
	if left_position == right_position:
		print('YES')
	else:
		print('NO')
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 < x2 and v1 > v2:
	catch_up(x1, v1, x2, v2)
elif x2 < x2 and v2 > v1:
	catch_up(x2, v2, x1, v1)
else:
	print('NO')


import sys
(x1, v1, x2, v2) = map(int, input().split())
if x1 == x2:
	print('YES')
else:
	if x1 > x2:
		(x1, v1, x2, v2) = (x2, v2, x1, v1)
	if v1 <= v2:
		print('NO')
	elif (x2 - x1) % (v1 - v2) == 0:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]

class Kangaroo:

	def __init__(self, x, v):
		self.x = x
		self.v = v

	def is_behind(self, other_kangaroo):
		return self.x < other_kangaroo.x

	def same_place(self, other_kangaroo):
		return self.x == other_kangaroo.x

	def move(self):
		self.x += self.v

def determine_outcome(x1, v1, x2, v2):
	if v1 > v2:
		faster = Kangaroo(x1, v1)
		slower = Kangaroo(x2, v2)
	elif v2 > v1:
		faster = Kangaroo(x2, v2)
		slower = Kangaroo(x1, v1)
	else:
		return x1 == x2
	while faster.is_behind(slower):
		faster.move()
		slower.move()
	return faster.same_place(slower)
if determine_outcome(x1, v1, x2, v2):
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 < x2 and v1 <= v2:
	print('NO')
	exit()
if x2 < x1 and v2 <= v1:
	print('NO')
	exit()
if abs(x2 - x1) % abs(v1 - v2) == 0:
	print('YES')
else:
	print('NO')


(x1, v1, x2, v2) = map(int, input().split())
numerator = -(x1 - x2)
denominator = v1 - v2
if denominator == 0:
	if numerator == 0:
		print('YES')
	else:
		print('NO')
elif numerator % denominator == 0 and numerator / denominator > 0:
	print('YES')
else:
	print('NO')


import sys

def simulate(x1, v1, x2, v2):
	while x1 < x2:
		x1 += v1
		x2 += v2
	if x1 == x2:
		print('YES')
	else:
		print('NO')
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 == x2:
	print('YES')
elif x1 > x2:
	if v1 >= v2:
		print('NO')
	else:
		simulate(x2, v2, x1, v1)
elif v1 <= v2:
	print('NO')
else:
	simulate(x1, v1, x2, v2)


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2:
	(x1, x2) = (x2, x1)
	(v1, v2) = (v2, v1)
if v1 > v2:
	while x1 < x2:
		x1 += v1
		x2 += v2
if x1 == x2:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2 and x1 == x2:
	print('YES')
elif v1 == v2 and x1 != x2:
	print('NO')
elif (x2 - x1) % (v1 - v2) == 0 and (x2 - x1) * (v1 - v2) >= 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if not v1 - v2 == 0 and (x2 - x1) // (v1 - v2) >= 0 and ((x2 - x1) % (v1 - v2) == 0):
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
butterfly = True
if v1 == v2:
	butterfly = False
elif v2 > v1:
	butterfly = False
else:
	dx = v1 - v2
	if dx < 0:
		butterfly = False
	else:
		d = x2 - x1
		if d // dx == d / dx:
			butterfly = True
		else:
			butterfly = False
if butterfly:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2:
	if v1 >= v2:
		print('NO')
	else:
		while x1 >= x2:
			if x1 == x2:
				print('YES')
				break
			x1 = x1 + v1
			x2 = x2 + v2
			if x1 < x2:
				print('NO')
elif x1 == x2:
	if v1 == v2:
		print('YES')
	else:
		print('NO')
elif v2 >= v1:
	print('NO')
else:
	while x2 >= x1:
		if x1 == x2:
			print('YES')
			break
		x1 = x1 + v1
		x2 = x2 + v2
		if x2 < x1:
			print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v2 - v1 != 0 and (x1 - x2) % (v2 - v1) == 0 and ((x1 - x2) // (v2 - v1) > 0):
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
val = True
if v2 >= v1:
	val = False
	print('NO')
while val:
	if x1 > x2:
		print('NO')
		break
	elif x1 == x2:
		print('YES')
		break
	else:
		x1 += v1
		x2 += v2


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	if x1 == x2:
		print('YES')
	else:
		print('NO')
else:
	r = (x2 - x1) / (v1 - v2)
	if r < 0 or (x2 - x1) % (v1 - v2) != 0:
		print('NO')
	else:
		print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if (x1 < x2) != (v1 > v2):
	print('NO')
	sys.exit(0)
x1_gt_x2 = x1 > x2
while True:
	x1 += v1
	x2 += v2
	if x1 == x2:
		print('YES')
		sys.exit(0)
	if x1_gt_x2 != (x1 > x2):
		print('NO')
		sys.exit(0)


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 <= v2 or (x2 - x1) % (v1 - v2) > 0:
	print('NO')
else:
	print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2:
	if v1 < v2:
		if (x1 - x2) % (v2 - v1):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')
elif x1 < x2:
	if v1 > v2:
		if (x2 - x1) % (v1 - v2):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')
else:
	print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 <= v2:
	print('NO')
elif (x2 - x1) % (v1 - v2):
	print('NO')
else:
	print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
lastDistance = 10000 + 1
distance = abs(x1 - x2)
while distance != 0 and distance < lastDistance:
	x1 += v1
	x2 += v2
	lastDistance = distance
	distance = abs(x1 - x2)
print('YES' if distance == 0 else 'NO')


(x1, v1, x2, v2) = map(int, input().split())
x = x1 - x2
v = v1 - v2
if v:
	ans = x % v == 0 and x // v < 0
else:
	ans = x == 0
print('YES' if ans else 'NO')


import sys

def kangaroo(x1, v1, x2, v2):
	if v1 == v2:
		print('YES' if x1 == x2 else 'NO')
		return
	x = (x2 - x1) / (v1 - v2)
	y = v1 * x + x1
	print('YES' if x == int(x) and x >= 0 and (y == int(y)) else 'NO')
(x1, v1, x2, v2) = map(int, input().strip().split(' '))
kangaroo(x1, v1, x2, v2)


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 <= v2 or (x2 - x1) % (v1 - v2):
	print('NO')
else:
	print('YES')


import sys
Final = False
temp = 0
Pos1 = []
Pos2 = []
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
Pos1.append(x1)
Pos2.append(x2)
while Final == False and temp < 10000:
	x1 += v1
	x2 += v2
	Pos1.append(x1)
	Pos2.append(x2)
	if Pos1[temp] == Pos2[temp]:
		print('YES')
		exit(0)
	else:
		temp += 1
print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 <= v2:
	print('NO')
else:
	while x1 < x2:
		x1 += v1
		x2 += v2
		if x1 == x2:
			break
	if x1 == x2:
		print('YES')
	else:
		print('NO')


(x1, v1, x2, v2) = map(int, input().split())
if v2 >= v1:
	print('NO')
elif (x2 - x1) % (v1 - v2) == 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 > v2 and x1 > x2:
	print('NO')
elif v2 > v1 and x2 > x1:
	print('NO')
elif v1 == v2:
	print('NO')
elif x1 == x2:
	print('YES')
else:
	j = (x2 - x1) / (v1 - v2)
	if j.is_integer():
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]

def kangaroo(x1, v1, x2, v2):
	if x1 == x2:
		print('YES')
	else:
		if x1 < x2:
			lt = True
			if v1 <= v2:
				return 'NO'
		else:
			lt = False
			if v1 >= v2:
				return 'NO'
		while x1 != x2:
			x1 += v1
			x2 += v2
			if x1 == x2:
				return 'YES'
				break
			if lt == True:
				if x1 > x2:
					return 'NO'
					break
			if lt == False:
				if x1 < x2:
					return 'NO'
					break
print(kangaroo(x1, v1, x2, v2))


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 - v2 > 0 and (x2 - x1) % (v1 - v2) == 0:
	print('YES')
else:
	print('NO')


(x1, v1, x2, v2) = map(int, input().split())
if v1 == v2 or (x1 - x2) % (v2 - v1) != 0 or (x1 - x2) // (v2 - v1) < 0:
	print('NO')
else:
	print('YES')


import sys

def calculate(x1, x2, v1, v2):
	if v1 == v2:
		if x1 != x2:
			return 1
		return 0
	if x1 == x2:
		return 0
	n = (x1 - x2) / (v2 - v1)
	if n < 0:
		return 1
	if int(n) == n:
		return 0
	return 1
sol = ['YES', 'NO']
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
print(sol[calculate(x1, x2, v1, v2)])


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2 and v1 < v2 or (x1 < x2 and v1 > v2):
	ahead = abs(x1 - x2)
	each_step_near = abs(v1 - v2)
	if ahead % each_step_near == 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
distance1 = x1
distance2 = x2
answer = 'NO'
if x2 > x1 and v2 > v1:
	answer = 'NO'
elif x1 > x2 and v1 > v2:
	answer = 'NO'
else:
	if x1 > x2:
		steps = 10000 - x1 // v1
	else:
		steps = 10000 - x2 // v2
	for i in range(steps + 1):
		distance1 += v1
		distance2 += v2
		if distance1 == distance2:
			answer = 'YES'
			break
print(answer)


(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
ans = 'YES'
try:
	x = (x1 - x2) / (v2 - v1)
except Exception:
	if x1 != x2:
		ans = 'NO'
else:
	if x < 0 or int(x) != x:
		ans = 'NO'
finally:
	print(ans)


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]

def solve(x, v, y, w):
	rel = v - w
	dis = y - x
	if dis == 0:
		return 'YES'
	while dis != 0:
		dis -= rel
		if abs(dis) >= abs(y - x):
			return 'NO'
	return 'YES'
print(solve(x1, v1, x2, v2))


import sys
import math
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
sum1 = x1 - x2
sum2 = v2 - v1
if sum2 == 0 and sum1 == 0:
	print('NO')
elif sum2 == 0:
	print('NO')
else:
	t = sum1 / sum2
	if int(t) != t:
		print('NO')
	elif t > 0.0:
		print('YES')
	else:
		print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	if x1 == x2:
		print('YES')
	else:
		print('NO')
else:
	n = (x2 - x1) / (v1 - v2)
	if n < 1 or n - int(n) > 0:
		print('NO')
	else:
		print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	print('NO')
elif (x2 - x1) / (v1 - v2) > 0 and (x2 - x1) / (v1 - v2) % 1 == 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
distanceDiff = x1 - x2
speedDiff = v2 - v1
isSameSign = (distanceDiff < 0) == (speedDiff < 0)
if isSameSign and distanceDiff % speedDiff == 0:
	print('YES')
else:
	print('NO')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [float(x1), float(v1), float(x2), float(v2)]
if x1 == x2 and v1 == v2:
	print('YES')
elif v1 == v2:
	print('NO')
else:
	xs = x2 - x1
	vs = v1 - v2
	lineX = xs / vs
	lineY = v1 * lineX + x1
	if lineX < 0 or lineY < x1 or lineY < x2:
		print('NO')
	elif lineX != int(lineX):
		print('NO')
	else:
		print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if x1 > x2:
	if v1 < v2:
		while x1 >= x2:
			x1 += v1
			x2 += v2
			if x1 == x2:
				print('YES')
				break
		else:
			print('NO')
	else:
		print('NO')
elif x1 < x2:
	if v1 > v2:
		while x1 <= x2:
			x1 += v1
			x2 += v2
			if x1 == x2:
				print('YES')
				break
		else:
			print('NO')
	else:
		print('NO')
else:
	print('YES')


import sys
(x1, v1, x2, v2) = input().strip().split(' ')
(x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)]
if v1 == v2:
	print('NO')
	quit()
n = (x2 - x1) / (v1 - v2)
if n < 0 or 1 > n % 1 > 0:
	print('NO')
else:
	print('YES')


def main():
	(x1, v1, x2, v2) = map(int, input().strip().split(' '))
	if x1 == x2:
		print('YES')
		return
	if v1 == v2:
		print('NO')
		return
	x = (-(v1 * x2) + v2 * x1) // (v2 - v1)
	t = float(x2 - x1) / float(v2 - v1)
	if x >= x1 and x >= x2 and (t == int(t)):
		print('YES')
	else:
		print('NO')
main()