Vasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is equal to a (s_1 = a), and the difference between any two neighbouring elements is equal to c (s_{i} - s_{i} - 1 = c). In particular, Vasya wonders if his favourite integer b appears in this sequence, that is, there exists a positive integer i, such that s_{i} = b. Of course, you are the person he asks for a help.


-----Input-----

The first line of the input contain three integers a, b and c ( - 10^9 ≤ a, b, c ≤ 10^9) — the first element of the sequence, Vasya's favorite number and the difference between any two neighbouring elements of the sequence, respectively.


-----Output-----

If b appears in the sequence s print "YES" (without quotes), otherwise print "NO" (without quotes).


-----Examples-----
Input
1 7 3

Output
YES

Input
10 10 0

Output
YES

Input
1 -4 5

Output
NO

Input
0 60 50

Output
NO



-----Note-----

In the first sample, the sequence starts from integers 1, 4, 7, so 7 is its element.

In the second sample, the favorite integer of Vasya is equal to the first element of the sequence.

In the third sample all elements of the sequence are greater than Vasya's favorite integer.

In the fourth sample, the sequence starts from 0, 50, 100, and all the following elements are greater than Vasya's favorite integer.

Difficulty: EASY
Tags: Mathematics

Starter code:

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


(a, b, c) = map(int, input().split())
if b == a or (c > 0 and b >= a and ((b - a) % c == 0)) or (c < 0 and a > b and ((a - b) % -c == 0)):
	print('YES')
else:
	print('NO')


from sys import stdin
for line in stdin:
	(a, b, c) = map(int, line.split(' '))
	print('YES' if a == b or (c != 0 and (b - a) % c == 0 and ((b - a) // c >= 0)) else 'NO')


(a, b, c) = map(int, input().split())
out = 'YES'
if b < a and c >= 0:
	out = 'NO'
elif b > a and c <= 0:
	out = 'NO'
elif b == a:
	out = 'YES'
else:
	dif = b - a
	if dif % c == 0:
		out = 'YES'
	else:
		out = 'NO'
print(out)


from math import floor, ceil
(a, b, c) = [int(i) for i in input().split()]
if c == 0:
	if b - a == 0:
		print('YES')
	else:
		print('NO')
else:
	n = (b - a) / c + 1
	if n > 0 and floor(n) == ceil(n):
		print('YES')
	else:
		print('NO')


(a, b, c) = map(int, input().split())
if c == 0 and a == b:
	print('YES')
	exit()
elif c == 0 and a != b:
	print('NO')
	exit()
x = (b - a) / c
if x.is_integer() and x >= 0:
	print('YES')
else:
	print('NO')


z = input().split()
x = list(map(int, z))
(a, b, c) = (x[0], x[1], x[2])
if a < b and c < 0:
	print('NO')
	exit(0)
if a > b and c > 0:
	print('NO')
	exit(0)
if a != b and c == 0:
	print('NO')
	exit(0)
if a == b:
	print('YES')
	exit(0)
if (b - a) % c == 0:
	print('YES')
else:
	print('NO')


import sys
inf = float('inf')
from math import ceil, floor, log, log2, sqrt, factorial, pow, pi, gcd

def powerMod(x, y):
	res = 1
	while y > 0:
		if y & 1:
			res = res * x
		y = y >> 1
		x = x * x
	return res
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(a, b, c) = get_ints()
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
	exit()
if c >= 0 and b < a or (c <= 0 and b > a):
	print('NO')
	exit()
n = (b - a) // c + 1
if a + (n - 1) * c == b:
	print('YES')
else:
	print('NO')


import sys
input1 = [int(elem) for elem in sys.stdin.readline().strip().split()]
if input1[1] == input1[0]:
	print('YES')
elif input1[1] > input1[0] and input1[2] > 0 and (input1[1] % input1[2] == input1[0] % input1[2]):
	print('YES')
elif input1[1] < input1[0] and input1[2] < 0 and (input1[1] % input1[2] == input1[0] % input1[2]):
	print('YES')
else:
	print('NO')


(a, b, c) = (int(s) for s in input().strip().split())
if a == b:
	print('YES')
elif c == 0:
	print('NO')
else:
	if a > b:
		c = -c
		(a, b) = (b, a)
	if c > 0 and (b - a) % c == 0:
		print('YES')
	else:
		print('NO')


l = input().split(' ')
a = int(l[0])
b = int(l[1])
c = int(l[2])
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif (b - a) % c == 0 and (b - a) * c >= 0:
	print('YES')
else:
	print('NO')


(a, b, c) = (int(_) for _ in input().split())
diff = b - a
if diff == 0 or (c != 0 and diff % c == 0 and (diff // c > 0)):
	print('YES')
else:
	print('NO')


d = list(map(int, input().split()))
if d[2] > 0:
	if d[0] > d[1]:
		print('NO')
	else:
		n = (d[1] - d[0]) / d[2] + 1
		if n % 1 == 0:
			print('YES')
		else:
			print('NO')
elif d[2] == 0:
	if d[0] == d[1]:
		print('YES')
	else:
		print('NO')
elif d[0] < d[1]:
	print('NO')
else:
	n = (d[1] - d[0]) / d[2] + 1
	if n % 1 == 0:
		print('YES')
	else:
		print('NO')


print(''.join(['YES' if c == 0 and a == b or (c != 0 and (b - a) % c == 0 and ((b - a) // c >= 0)) else 'NO' for (a, b, c) in [map(int, input().split())]]))


(a, b, d) = map(int, input().split())
if d == 0 or a == b:
	if a == b:
		print('YES')
	else:
		print('NO')
elif (b - a) % d == 0 and (b - a) * d > 0:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if c != 0:
	if (b - a) % c == 0:
		n = (b - a) // c + 1
		if n > 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
elif a == b:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
	exit()
if a == b:
	print('YES')
elif a > b:
	if c > 0:
		print('NO')
	elif (b - a) % c == 0:
		print('YES')
	else:
		print('NO')
elif c < 0:
	print('NO')
elif (b - a) % c == 0:
	print('YES')
else:
	print('NO')


def s(a):
	if a < 0:
		return -1
	return 1
(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif a < b and c < 0:
	print('NO')
elif a > b and c > 0:
	print('NO')
else:
	dif = b - a
	if dif % c == 0:
		print('YES')
	else:
		print('NO')


(a, b, c) = map(int, input().split())
try:
	if (b - a) * c >= 0 and (b - a) % c == 0:
		print('YES')
	else:
		print('NO')
except:
	if c == 0 and a == b:
		print('YES')
	else:
		print('NO')


(f, r, d) = list(map(int, input().split()))
if f == r:
	print('YES')
elif d == 0 and f == r:
	print('YES')
elif d == 0 and f != r:
	print('NO')
elif (r - f) // d == (r - f) / d and (r - f) / d > 0:
	print('YES')
else:
	print('NO')


inp = input('')

def returnstatus(inp):
	(firstelement, favnumber, diff) = [int(i) for i in inp.split(' ')]
	if diff == 0:
		return 'YES' if firstelement == favnumber else 'NO'
	return 'YES' if (favnumber - firstelement) % diff == 0 and (favnumber - firstelement) / diff >= 0 else 'NO'
print(returnstatus(inp))


def solve():
	(a, b, c) = map(int, input().split())
	if a == b:
		return True
	if not c:
		return False
	if a > b and c > 0:
		return False
	if b > a and c < 0:
		return False
	return not (b - a) % c
print('NYOE S'[solve()::2])


import sys
(a, b, c) = map(int, sys.stdin.readline().split())
if c < 0:
	a = -a
	c = -c
	b = -b
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif (b - a) % c == 0 and a <= b:
	print('YES')
else:
	print('NO')


(Seq_Element, myNum, incr) = [int(x) for x in input().split()]
if incr == 0:
	print('YES') if Seq_Element == myNum else print('NO')
elif incr < 0 and Seq_Element < myNum or (incr > 0 and Seq_Element > myNum):
	print('NO')
elif (myNum - Seq_Element) % incr != 0:
	print('NO')
else:
	print('YES')


import math
(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	n = (b + c - a) / c
	if math.floor(n) == n:
		if n >= 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


[a, b, c] = list(map(int, input().split()))
d = b - a
if a == b:
	print('YES')
	exit(0)
if d > 0 and c <= 0 or (d < 0 and c >= 0):
	print('NO')
	exit(0)
d = abs(d)
c = abs(c)
if d % c != 0:
	print('NO')
	exit(0)
print('YES')


(a, b, d) = map(int, input().split())
if d != 0:
	if (b - a) / d == float(abs(int((b - a) / d))):
		print('YES')
	else:
		print('NO')
elif b == a:
	print('YES')
else:
	print('NO')


import math
import os
import random
import re
import sys
x = list(map(int, input().rstrip().split()))
(a, b, c) = (x[0], x[1], x[2])
if c == 0:
	if b - a == 0:
		print('YES')
	else:
		print('NO')
else:
	k = (b - a) % c
	if k == 0 and (b - a) / c >= 0:
		print('YES')
	else:
		print('NO')


def main():
	(a, b, c) = [int(x) for x in input().split()]
	if a == b:
		print('YES')
	elif c == 0:
		print('YES' if b == a else 'NO')
	else:
		n = (b - a) // abs(c)
		x = (b - a) % abs(c)
		print('YES' if x == 0 and n * c > 0 else 'NO')
main()


from sys import stdin

def main():
	numbers = stdin.readline().split()
	(a, b, c) = (int(numbers[0]), int(numbers[1]), int(numbers[2]))
	r = False
	if c == 0:
		r = a == b
	else:
		r = (b - a) // c >= 0 and (b - a) % c == 0
	if r:
		print('YES')
	else:
		print('NO')
main()


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
lx = lambda x: map(int, input().split(x))

def f():
	(a, b, c) = ll()
	if c == 0 and a == b:
		print('YES')
		return
	elif c == 0 and a != b:
		print('NO')
		return
	n = (b - a) // c + 1
	if n > 0 and a + (n - 1) * c == b:
		print('YES')
	else:
		print('NO')
f()


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


line = input()
lin = list(map(int, line.split()))
flag = 1
tmp = lin[1] - lin[0]
if lin[2] == 0:
	if tmp == 0:
		flag = 0
elif tmp >= 0 and lin[2] > 0:
	flag = tmp % lin[2]
elif tmp <= 0 and lin[2] < 0:
	flag = abs(tmp) % abs(lin[2])
if flag == 0:
	print('YES')
else:
	print('NO')


(a, b, c) = (int(i) for i in input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif c > 0 and b < a:
	print('NO')
elif c < 0 and b > a:
	print('NO')
else:
	n = (b - a) / c + 1
	if n == int(n):
		print('YES')
	else:
		print('NO')


x = list(map(int, input().split()))
a = x[0]
b = x[1]
c = x[2]
if a == b:
	print('YES')
elif a > b:
	if c >= 0:
		print('NO')
	else:
		d = abs(a - b)
		if d % abs(c) == 0:
			print('YES')
		else:
			print('NO')
elif c <= 0:
	print('NO')
else:
	d = abs(a - b)
	if d % abs(c) == 0:
		print('YES')
	else:
		print('NO')


(x, y, z) = map(int, input().split(' '))
if x == y and z == 0:
	print('YES')
	exit()
if x < y and z == 0:
	print('NO')
	exit()
if x > y and z == 0:
	print('NO')
	exit()
k = (y - x) / z
if k == (y - x) // z and k >= 0:
	print('YES')
else:
	print('NO')


(start, target, step) = map(int, input().split())
if (step > 0 and target >= start or (step < 0 and target <= start)) and (target - start) % step == 0 or (step == 0 and target == start):
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
ba = b - a
try:
	print(('NO', 'YES')[ba % c == 0 and ba // c >= 0])
except:
	print(('YES', 'NO')[b != a])


import sys
input = list(map(int, sys.stdin.readline().strip().split()))
if input[1] == input[0]:
	print('YES')
elif input[2] < 0 and input[1] <= input[0] and (input[1] % input[2] == input[0] % input[2]):
	print('YES')
elif input[2] > 0 and input[1] >= input[0] and (input[1] % input[2] == input[0] % input[2]):
	print('YES')
else:
	print('NO')


string = input()
numbers = string.split(' ')
a = int(numbers[0])
b = int(numbers[1])
c = int(numbers[2])
if c != 0:
	a += abs(b - a) // abs(c) * c
if a == b:
	results = 'YES'
else:
	results = 'NO'
print(results)


(a, b, c) = map(int, input().split())
if c and (not (a - b) % c) and (max(a + c, b) - min(b, a + c) < max(a, b) - min(a, b)) or a == b:
	print('YES')
else:
	print('NO')


(a, b, c) = [int(x) for x in input().split()]
if c != 0 and (b - a) / c >= 0 and ((b - a) % c == 0) or (c == 0 and a == b):
	print('YES')
else:
	print('NO')


(a, b, c) = [int(i) for i in input().split()]
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif (b - a) % c == 0:
	if (b - a) / c >= 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import math, sys, re, itertools
(rs, ri, rai) = (input, lambda : int(input()), lambda : list(map(int, input().split())))
(a, b, c) = rai()
flag = False
if a == b:
	flag = True
if c != 0 and (not (b > a and c < 0 or (b < a and c > 0))):
	d = (b - a + c) % c
	flag = d == 0
print('YES' if flag else 'NO')


(start, end, step) = map(int, input().split())
if step == 0:
	if start == end:
		print('YES')
	else:
		print('NO')
else:
	n = (end - start) / step
	print('YES' if n.is_integer() and n >= 0 else 'NO')


from __future__ import print_function

def solvecase():
	return ''

def solve():
	(a, b, c) = map(int, input().strip().split())
	if c < 0:
		b = a + (a - b)
		c = -c
	if c == 0:
		if a == b:
			return 'YES'
		else:
			return 'NO'
	b = b - a
	if b > 0 and b % c == 0:
		return 'YES'
	elif b == 0:
		return 'YES'
	else:
		return 'NO'

def main():
	print(str(solve()))
main()


(a, b, c) = map(int, input().split())
if c == 0 and a == b:
	exit(print('YES'))
elif c == 0 and a != b:
	exit(print('NO'))
(l, r) = (0, 2 * 10 ** 9)
while l <= r:
	mid = (l + r) // 2
	s = a + mid * c
	if s == b:
		exit(print('YES'))
	elif s > b:
		if c > 0:
			r = mid - 1
		else:
			l = mid + 1
	elif c > 0:
		l = mid + 1
	else:
		r = mid - 1
print('NO')


def eval_series(a, b, c):
	if c == 0:
		if a == b:
			return 'YES'
		else:
			return 'NO'
	if a > b and c > 0:
		return 'NO'
	if a < b and c < 0:
		return 'NO'
	rem = (b - a) % c
	if rem == 0:
		return 'YES'
	else:
		return 'NO'
str = input()
(a, b, c) = map(int, str.split())
print(eval_series(a, b, c))


from __future__ import division
(a, b, c) = map(int, input().split())
if c == 0:
	if b == a:
		print('YES')
	else:
		print('NO')
elif (b - a) % c == 0 and (b - a) // c + 1 > 0:
	print('YES')
else:
	print('NO')


abc = input().split()
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
d = b - a
if c == 0:
	if d == 0:
		print('YES')
	else:
		print('NO')
elif c > 0:
	if (d >= 0) * (d % c == 0):
		print('YES')
	else:
		print('NO')
else:
	d = -d
	if (d >= 0) * (d % c == 0):
		print('YES')
	else:
		print('NO')


(a, b, c) = map(int, input().strip().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif b < a and c > 0:
	print('No')
elif b > a and c < 0:
	print('No')
elif (b - a) % c == 0:
	print('YES')
else:
	print('NO')


import sys
temp = input().split()
a = int(temp[0])
b = int(temp[1])
c = int(temp[2])
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif (b - a) % c == 0 and (b - a) / c >= 0:
	print('YES')
else:
	print('NO')


import math
line = input().split(sep=' ')
start = int(line[0])
fav = int(line[1])
inc = int(line[2])
if fav == start:
	print('YES')
elif inc == 0:
	print('NO')
else:
	bool = fav - start % inc == 0
	x = math.ceil((fav - start) / inc)
	if start + inc * x == fav:
		if start > fav and inc < 0 or (start < fav and inc > 0):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


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


(a, b, c) = map(int, input().split())
if b - a > 0 and c > 0:
	if round((b - a) % c):
		print('NO')
	else:
		print('YES')
elif b - a < 0 and c < 0:
	if round((a - b) % abs(c)):
		print('NO')
	else:
		print('YES')
elif a == b:
	print('YES')
else:
	print('NO')


import math
(a, b, c) = [int(x) for x in input().split()]
ans = False
if c == 0:
	if b == a:
		ans = True
else:
	temp = (b - a) / c
	if temp >= 0:
		if temp == math.floor(temp):
			ans = True
print(('NO', 'YES')[ans])


(a, b, c) = [int(z) for z in input().split()]
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif b - a == 0:
	print('YES')
elif b - a == c or (b - a) % c == 0:
	if a < b and c > 0 or (a > b and c < 0):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def algrorythm(a, b, c):
	try:
		if (a - b) % c == 0:
			print('YES')
		else:
			print('NO')
	except:
		if a == b:
			print('YES')
		else:
			print('NO')
m = [int(i) for i in input().split()]
(a, b, c) = (m[0], m[1], m[2])
if c >= 0:
	if b >= a:
		algrorythm(a, b, c)
	else:
		print('NO')
elif b <= a:
	algrorythm(a, b, c)
else:
	print('NO')


def task_1():
	result = 'YES'
	(a, b, c) = map(lambda x: int(x), input().split(' '))
	if a == b:
		return 'YES'
	elif c == 0 and a != b:
		return 'NO'
	d = float(b - a) / c
	if d > 0 and d == int(d):
		result = 'YES'
	else:
		result = 'NO'
	return result
print(task_1())


from math import *
(a, b, c) = map(int, input().split())
sex = a
fuck = b
suck = c
if suck == 0 and sex == fuck:
	print('YES')
elif suck == 0 and sex != fuck:
	print('NO')
elif (fuck - sex) % suck == 0 and (fuck - sex) / suck >= 0:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if c != 0:
	rem = (b - a) % c
	divisor = (b - a) / c
	if divisor >= 0 and rem == 0:
		print('YES')
	else:
		print('NO')
elif a == b:
	print('YES')
else:
	print('NO')


import sys
import math
import bisect

def solve(a, b, c):
	if c == 0:
		return b == a
	if c > 0:
		return b >= a and (b - a) % c == 0
	return b <= a and (a - b) % -c == 0

def main():
	(a, b, c) = map(int, input().split())
	if solve(a, b, c):
		print('YES')
	else:
		print('NO')
main()


(a, b, c) = tuple(map(int, input().split()))
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	n = (b - a) // c
	if n >= 0 and a + n * c == b:
		print('YES')
	else:
		print('NO')


import math

def main():
	(a, b, c) = map(int, input().split())
	if a < b:
		if c <= 0:
			return 'NO'
		elif abs(b - a) % c == 0:
			return 'YES'
		else:
			return 'NO'
	else:
		if a == b:
			return 'YES'
		if c >= 0:
			return 'NO'
		elif abs(b - a) % c == 0:
			return 'YES'
		else:
			return 'NO'
print(main())


__author__ = 'artyom'

def main():
	(a, b, c) = read(3)
	if a > b:
		(a, b) = (b, a)
		c = -c
	if c <= 0:
		return 1 if a == b else 0
	return 1 if (b - a) % c == 0 else 0

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(['NO', 'YES'][main()])


(a, b, c) = map(int, input().split())
if c == 0:
	print(['No', 'Yes'][a == b])
else:
	print(['No', 'Yes'][(b - a) // c >= 0 and (b - a) % c == 0])


list1 = list(map(int, input().split()))
if list1[2] == 0:
	if list1[1] == list1[0]:
		print('YES')
	else:
		print('NO')
elif list1[1] < list1[0] and list1[2] > 0 or (list1[1] > list1[0] and list1[2] < 0):
	print('NO')
elif (list1[1] - list1[0]) % list1[2] == 0:
	print('YES')
else:
	print('NO')


s = input().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
if c < 0:
	if b > a:
		print('NO')
	elif b % c == a % c:
		print('YES')
	else:
		print('NO')
elif c == 0:
	if b == a:
		print('YES')
	else:
		print('NO')
elif c > 0:
	if b < a:
		print('NO')
	elif b % c == a % c:
		print('YES')
	else:
		print('NO')


def YES():
	print('YES')
	exit()

def NO():
	print('NO')
	exit()
(a, b, c) = [int(x) for x in input().split(' ')]
d = b - a
if d == 0:
	YES()
if c == 0:
	NO()
if d > 0 and c < 0 or (d < 0 and c > 0):
	NO()
if d % c == 0:
	YES()
NO()


inpt = input().split()
a = int(inpt[0])
b = int(inpt[1])
c = int(inpt[2])
res = b - a
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif b < a and c > 0:
	print('NO')
elif a < b and c < 0:
	print('NO')
else:
	x = res % c
	if x == 0:
		print('YES')
	else:
		print('NO')


import sys
(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
	sys.exit(0)
if (b - a) % c == 0 and (b - a) // c >= 0:
	print('YES')
else:
	print('NO')


def main():
	(a, b, c) = map(int, input().split())
	if b == a:
		print('YES')
		exit(0)
	if b > a and c <= 0 or (b < a and c >= 0):
		print('NO')
		exit(0)
	diff = abs(a - b)
	if diff % abs(c) == 0:
		print('YES')
	else:
		print('NO')
main()


read = lambda : map(int, input().split())
(a, b, c) = read()
if c == 0 and b == a:
	ans = 'YES'
elif c != 0 and (b - a) % c == 0:
	if c > 0 and b >= a:
		ans = 'YES'
	elif c < 0 and b <= a:
		ans = 'YES'
	else:
		ans = 'NO'
else:
	ans = 'NO'
print(ans)


import sys
x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
if c == 0:
	if a == b:
		print('YES')
		sys.exit(0)
else:
	p = (b - a) / c + 1
	if int(p) == float(p) and p > 0:
		print('YES')
		sys.exit(0)
print('NO')


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(number_of_variables):
	if number_of_variables == 1:
		return int(sys.stdin.readline())
	if number_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
mod = 100000007
(a, b, c) = vary(3)
if c == 0:
	if b == a:
		print('YES')
	else:
		print('NO')
	exit()
if math.floor((b - a) / c + 1) == (b - a) / c + 1 and (b - a) / c + 1 > 0:
	print('YES')
else:
	print('NO')


(a, b, d) = map(int, input().strip().split(' '))
if d == 0:
	if a == b:
		print('yes')
	else:
		print('no')
elif a == b:
	print('yes')
elif (b - a) % d == 0 and (b - a) * d > 0:
	print('yes')
else:
	print('no')


(a, b, c) = map(int, input().split())
f = 0
if a == b:
	f = 1
elif c == 0:
	f = 0
elif b - a < 0 and c > 0 or (b - a > 0 and c < 0):
	f = 0
elif (b - a) % c == 0:
	f = 1
if f == 1:
	print('YES')
else:
	print('NO')


(start, aim, step) = map(int, input().split())
if start < aim and step <= 0:
	print('NO')
elif start > aim and step > 0:
	print('NO')
elif start == aim:
	print('YES')
elif step == 0:
	print('NO')
elif start % step == aim % step:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if a == b:
	print('YES')
elif c != 0:
	x = (b - a) / c - 1
	if x < 0 or x != float(int(x)):
		print('NO')
	else:
		print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if c:
	(div, mod) = divmod(b - a, c)
	print('NO' if mod or div < 0 else 'YES')
else:
	print('YES' if a == b else 'NO')


__author__ = 'zihaozhu'
from sys import stdin
(s, f, i) = map(int, stdin.readline().split())
if s == f:
	print('YES')
elif i == 0:
	print('NO')
elif (f - s) % i == 0 and (f - s > 0 and i > 0 or (f - s < 0 and i < 0)):
	print('YES')
else:
	print('NO')


x = list(map(int, input().split()))
y = x[1] - x[0]
if y == 0:
	print('YES')
elif x[2] == 0:
	print('NO')
else:
	z = y % x[2]
	if z == 0:
		if y // x[2] > 0:
			print('YES')
		elif y // x[2] > 0 and x[2] < 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def infseq(inp):
	s = inp.split()
	a = float(s[0])
	b = float(s[1])
	c = float(s[2])
	if a == b:
		return 'YES'
	elif c == 0:
		return 'NO'
	diff = (b - a) / c
	if diff.is_integer() and diff >= 0:
		return 'YES'
	else:
		return 'NO'

def main():
	inp = input()
	print(infseq(inp))
main()


(a, b, c) = map(int, input().split())

def solve(a, b, c):
	if c == 0:
		return a == b
	elif c < 0:
		(a, b, c) = (-a, -b, -c)
	return b >= a and b % c == a % c
print('YES' if solve(a, b, c) else 'NO')


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = [2]
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(3, limit + 1, 2):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	(a, b, c) = mp()
	if c == 0:
		if a != b:
			print('NO')
		else:
			print('YES')
		return
	x = (b - a + c) / c
	if x == math.floor(x) and x > 0:
		print('YES')
	else:
		print('NO')
for _ in range(1):
	solve()


(a, b, c) = [int(x) for x in input().split()]
if c == 0:
	if b == a:
		print('YES')
	else:
		print('NO')
else:
	n = (b - a) / c
	if n < 0:
		print('NO')
	elif n == int(n):
		print('YES')
	else:
		print('NO')


def main():
	(a, b, c) = map(int, input().split())
	if c == 0:
		if b == a:
			print('YES')
		else:
			print('NO')
		return
	print('YES' if (b - a) % c == 0 and (c > 0 and b >= a or (c < 0 and b <= a)) else 'NO')
main()


from sys import stdin
input = stdin.readline
(a, b, c) = map(int, input().split())
print(['NO', 'YES'][c > 0 and b >= a and (not (b - a) % c) or (c < 0 and a >= b and (not (b - a) % c)) or (c == 0 and a == b)])


(a, b, c) = map(int, input().split())

def div(a, b):
	if a == 0 or b == 0:
		return 0
	return a / b
n = div(b - a, c) + 1
if a + (n - 1) * c == b and n >= 1 and (n == int(n)):
	print('YES')
else:
	print('NO')


import math
(a, s, d) = input().split()
a = int(a)
s = int(s)
d = int(d)

def check(a, s, d):
	if d != 0:
		n = (s - a) / d + 1
		j = n % 1
		if j == 0.0:
			if n > 0:
				return 'YES'
	if d == 0:
		if a == s:
			return 'YES'
	return 'NO'
print(check(a, s, d))


try:
	while True:
		(a, b, c) = map(int, input().split())
		if c == 0:
			print('YES' if a == b else 'NO')
		elif c > 0:
			print('YES' if b in range(a, int(10000000000.0), c) else 'NO')
		else:
			print('YES' if b in range(a, int(-10000000000.0), c) else 'NO')
except EOFError:
	pass


(a1, c, d) = [int(x) for x in input().split()]
try:
	if (c - a1) % d == 0 and (c - a1) / d + 1 >= 1:
		print('YES')
	else:
		print('NO')
except:
	if c == a1:
		print('YES')
	else:
		print('NO')


(a, b, c) = str(input()).split()
a = int(a)
b = int(b)
c = int(c)
if c == 0:
	if a == b:
		print('YES')
		exit()
	else:
		print('NO')
		exit()
if (b - a) % c == 0:
	if b > a and c > 0:
		print('YES')
	elif b < a and c < 0:
		print('YES')
	elif a == b:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


list = input().split(' ')
a = int(list[0])
b = int(list[1])
c = int(list[2])
d = b - a
if b == a:
	print('YES')
elif c == 0:
	print('NO')
elif d % c == 0 and d / c > 0:
	print('YES')
else:
	print('NO')


(a, b, c) = list((int(x) for x in input().split()))
if c > 0 and b >= a:
	if (b - a) % c == 0:
		print('YES')
	else:
		print('NO')
elif c < 0 and b <= a:
	if (a - b) % abs(c) == 0:
		print('YES')
	else:
		print('NO')
elif c == 0 and a == b:
	print('YES')
else:
	print('NO')


class InfiniteSequence:

	def __init__(self, lst):
		self.a = lst[0]
		self.b = lst[1]
		self.c = lst[2]

	def yesOrNo(self):
		if self.b - self.a == 0:
			print('YES')
		elif self.c == 0:
			if self.b - self.a == 0:
				print('YES')
			else:
				print('NO')
		else:
			x = self.b - self.a
			y = self.c
			z = x / y
			if z == int(z) and (x < 0 and y < 0 or (x > 0 and y > 0)):
				print('YES')
			else:
				print('NO')
lst = [int(n) for n in input().split()]
obj = InfiniteSequence(lst)
obj.yesOrNo()


def main():
	(a, b, c) = (int(x) for x in input().strip().split(' '))
	if b < a and c > 0:
		print('NO')
		return
	if b > a and c < 0:
		print('NO')
		return
	if c == 0:
		if a == b:
			print('YES')
		else:
			print('NO')
		return
	if (b - a) % c == 0:
		print('YES')
		return
	print('NO')
main()


class baby:

	def __init__(self, gen, name):
		self.name = name
		self.gender = gen
		self.energy = 100

	def laugh(self):
		print('Uhahaha')
		self.energy -= 5

	def feed(self):
		self.energy = 100
		print("I'm full mom!")

	def __str__(self):
		return 'My name is %s' % self.name

def main():
	b1 = baby('boy', 'smith')
	b1.laugh()
	b1.feed()
	print(b1)

def a657():
	(a, b, c) = map(int, input().split())
	if c >= 0 and b < a or (c <= 0 and b > a):
		print('NO')
		return 0
	if a == b or (b - a) % c == 0:
		print('YES')
	else:
		print('NO')
a657()


(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
	exit(0)
k = (b - a) / c
if k == int(k) and k >= 0:
	print('YES')
else:
	print('NO')


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


(a, b, c) = map(int, input().split())
t = 10 ** 10
if c < 0:
	t *= -1
if c == 0:
	print(['NO', 'YES'][a == b])
else:
	print(['NO', 'YES'][b in range(a, t, c)])


[a, b, c] = [int(x) for x in input().split()]

def runcodeifcpositive():
	if c == 0:
		print('YES') if a == b else print('NO')
	elif b < a:
		print('NO')
	elif a < 0:
		x = a + a * -1
		y = b + a * -1
		if y % c == 0:
			print('YES')
		else:
			print('NO')
	elif a >= 0:
		if (b - a) % c == 0:
			print('YES')
		else:
			print('NO')

def runcodeifcnegative():
	[x, y, z] = [a * -1, b * -1, c * -1]
	if c == 0:
		print('YES') if x == y else print('NO')
	elif y < x:
		print('NO')
	elif x < 0:
		e = x + x * -1
		f = y + x * -1
		if f % z == 0:
			print('YES')
		else:
			print('NO')
	elif x >= 0:
		if (y - x) % z == 0:
			print('YES')
		else:
			print('NO')
if c >= 0:
	runcodeifcpositive()
else:
	runcodeifcnegative()


from math import ceil, floor
(a, b, c) = map(int, input().split())
if c == 0:
	print('YES' if a == b else 'NO')
	exit(0)
i = (b - a) / c
if i >= 0 and ceil(i) == floor(i):
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split(' '))
try:
	n = (b - a) / c + 1
	if int(n) == n and n > 0:
		print('YES')
	else:
		print('NO')
except ZeroDivisionError:
	if a == b:
		print('YES')
	else:
		print('NO')


def check(a, b, c):
	if c == 0 and a == b:
		return 'YES'
	elif c == 0 and (not a == b):
		return 'NO'
	elif (b - a) / c >= 0 and (b - a) % c == 0:
		return 'YES'
	else:
		return 'NO'
data = input().split(' ')
for i in range(3):
	data[i] = int(data[i])
aux = check(data[0], data[1], data[2])
print(aux)


(p, q, r) = map(int, input().split())
if r > 0:
	if p > q:
		print('NO')
		exit(0)
elif r == 0:
	if p != q:
		print('NO')
	else:
		print('YES')
	exit(0)
elif q > p:
	print('NO')
	exit(0)
if not (q - p) % r:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
ans = b - a
if c == 0 and ans == 0:
	print('YES')
	exit()
elif c == 0:
	print('NO')
	exit()
if ans < 0 and c > 0 or (ans > 0 and c < 0):
	print('NO')
	exit()
if ans % c == 0:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	i = (b - a + c) // c
	if i >= 1 and b == a + c * (i - 1):
		print('YES')
	else:
		print('NO')


inp = input().split()
for i in range(0, 3):
	inp[i] = int(inp[i])
a = inp[0]
b = inp[1]
c = inp[2]
div = c
if div != 0:
	if (b - a) % div == 0 and (b - a) / div >= 0:
		print('YES')
	else:
		print('NO')
elif b == a:
	print('YES')
else:
	print('NO')


inp = input().split()
a = int(inp[0])
b = int(inp[1])
c = int(inp[2])
if c == 0:
	if b != a:
		print('NO')
	else:
		print('YES')
elif c > 0:
	if b < a or (b - a) % c != 0:
		print('NO')
	else:
		print('YES')
elif b > a or (a - b) % -c != 0:
	print('NO')
else:
	print('YES')


from collections import *
(a, b, c) = list(map(int, input().split()))
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif a % c == b % c:
	if a >= b and c < 0 or (a <= b and c > 0):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import math
inp = input()
a = int(inp.split()[0])
b = int(inp.split()[1])
c = int(inp.split()[2])
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	flag = (b + c - a) / c
	if flag > 0 and flag - math.floor(flag) == 0.0:
		print('YES')
	else:
		print('NO')


[a, b, c] = [int(item) for item in input().split(' ')]
YES = 'YES'
NO = 'NO'
diff = b - a
if c:
	if diff == 0:
		print('YES')
		exit()
	print('YES' if diff // abs(diff) == c // abs(c) and diff % c == 0 else 'NO')
else:
	print('YES' if a == b else 'NO')


def solve(a, x, d):
	kd = x - a
	if d == 0:
		if kd == 0:
			return 'YES'
		else:
			return 'NO'
	if kd % d != 0:
		return 'NO'
	if kd / d < 0:
		return 'NO'
	return 'YES'
(a, x, d) = map(int, input().split())
print(solve(a, x, d))


def solve(a, b, c):
	if a == b:
		return 'YES'
	if c == 0:
		return 'NO'
	k = (b - a) // c
	if k < 0:
		return 'NO'
	if a + k * c != b:
		return 'NO'
	return 'YES'
(a, b, c) = map(int, input().split())
print(solve(a, b, c))


(a, b, c) = [int(x) for x in input().split(' ')]
ans = 'NO'
if c == 0:
	if a == b:
		ans = 'YES'
elif c > 0:
	if b >= a and b % c == a % c:
		ans = 'YES'
elif b <= a and b % c == a % c:
	ans = 'YES'
print(ans)


def favourite_number(a, b, c):
	if b - a == 0:
		return 'YES'
	elif c == 0:
		return 'NO'
	elif (b - a) % c != 0 or (b - a) * c < 0:
		return 'NO'
	return 'YES'
(A, B, C) = [int(i) for i in input().split()]
print(favourite_number(A, B, C))


from sys import stdin

def parse():
	pass
	line = stdin.readline().split()
	(a, b, c) = map(int, line)
	if a == b:
		print('YES')
	elif c == 0:
		print('NO')
	elif (b - a) * c > 0:
		rem = (b - a) % c
		if rem == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
parse()


(a, b, d) = [int(i) for i in input().split()]
try:
	if (b - a) % d == 0 and (b - a) / d >= 0:
		print('YES')
	else:
		print('NO')
except:
	if a == b:
		print('YES')
	else:
		print('NO')


(a, b, c) = [int(x) for x in input().split()]
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
	quit()
tmp1 = (b - a) / c
tmp2 = (b - a) // c
if tmp1 == tmp2 and tmp1 >= 0.0 and (tmp2 >= 0):
	print('YES')
else:
	print('NO')


(a, c, d) = map(int, input().split())
if d != 0:
	n = (c - a) / d + 1
	if int(n) == n and n > 0:
		print('YES')
	else:
		print('NO')
elif a == c:
	print('YES')
else:
	print('NO')


tres = map(int, input().split())
a = next(tres)
b = next(tres)
c = next(tres)
if c == 0 and a == b:
	print('YES')
elif c == 0 and a != b:
	print('NO')
elif a > b and c > 0:
	print('NO')
elif a < b and c < 0:
	print('NO')
elif b % c == a % c:
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def check(n, m, k):
	print('inside', n + (k - 1) * m, k * (k + 1) // 2, (n + (k - 1) * m) // k * k)
	if (n + (k - 1) * m) // k * k <= k * (k + 1) // 2:
		return True
	return False

def solve():
	(a, b, c) = map(int, input().split())
	if a != b and c == 0:
		print('NO')
		return
	elif c == 0 and a == b:
		print('YES')
		return
	ans = (b - a) / c
	if ans < 0:
		print('NO')
		return
	print(['NO', 'YES'][math.ceil(ans) == math.floor(ans)])
for _ in range(1):
	solve()


import sys
inputs = sys.stdin.readline()
myv = inputs.strip().split()
a = int(myv[0])
b = int(myv[1])
c = int(myv[2])
if c == 0:
	if b == a:
		print('YES')
	else:
		print('NO')
else:
	result = 1.0 * (b - a) / c
	if result == round(result) and result >= 0:
		print('YES')
	else:
		print('NO')


import sys

def readlines(type=int):
	return list(map(type, sys.stdin.readline().split()))

def read(type=int):
	return type(sys.stdin.readline())
joint = lambda it, sep=' ': sep.join([str(i) if type(i) != list else sep.join(map(str, i)) for i in it])

def solve(a, b, c):
	if c == 0:
		if a == b:
			return 'YES'
		else:
			return 'NO'
	n = (b - a) / c + 1
	if n > 0 and n - int(n) == 0:
		return 'YES'
	return 'NO'

def main():
	(a, b, c) = readlines()
	print(solve(a, b, c))
main()


(q, w, e) = map(int, input().split())
a = w - q
if q == w:
	print('YES')
elif e == 0:
	print('NO')
elif a * e >= 0:
	if a % e == 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def f(l):
	(a, b, c) = l
	if c == 0:
		return a == b
	return (b - a) % c == 0 and (b - a) // c >= 0
l = list(map(int, input().split()))
print('YES' if f(l) else 'NO')


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	if c > 0 and a > b:
		print('NO')
		exit(0)
	if c < 0 and a < b:
		print('NO')
		exit(0)
	if (b - a) % c == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from operator import mul
from functools import reduce

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	(a, b, c) = invr()
	x = b - a
	if c == 0:
		if a == b:
			print('YES')
			return
		else:
			print('NO')
			return
	if x % c == 0 and x // c >= 0:
		print('YES')
	else:
		print('NO')
main()


from re import *
from sys import stderr

def readint():
	return int(input())

def readfloat():
	return float(input())

def readarray(N, foo=input):
	return [foo() for i in range(N)]

def readlinearray(foo=int):
	return map(foo, input().split())

def NOD(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def gen_primes(max):
	primes = [1] * (max + 1)
	for i in range(2, max + 1):
		if primes[i]:
			for j in range(i + i, max + 1, i):
				primes[j] = 0
	primes[0] = 0
	return [x for x in range(max + 1) if primes[x]]

def is_prime(N):
	i = 3
	if not N % 2:
		return 0
	while i * i < N:
		if not N % i:
			return 0
		i += 3
	return 1
(a, b, c) = readlinearray()
b -= a
if b == 0 or (c != 0 and c * b > 0 and (b % c == 0)):
	print('YES')
else:
	print('NO')


s = [int(n) for n in input().split()]
a = s[0]
d = s[2]
x = s[1]
if d != 0:
	z = (x - a) / d + 1
	if z == int(z) and z > 0:
		print('YES')
	else:
		print('NO')
elif a == x:
	print('YES')
else:
	print('NO')


from math import ceil
(a, b, c) = map(int, input().split())
if a == b:
	print('YES')
elif c == 0:
	print('NO')
else:
	n = (b - a) / c
	print('YES' if n > 0 and n == ceil(n) else 'NO')


(a, b, c) = str(input()).split()
a = int(a)
b = int(b)
c = int(c)
flag = False
if c > 0:
	if b >= a and (b - a) % c == 0:
		flag = True
elif c < 0:
	if b <= a and (b - a) % c == 0:
		flag = True
elif a == b:
	flag = True
if flag:
	print('YES')
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(a, b, c) = LI()
	if a == b:
		return 'YES'
	if c == 0:
		return 'NO'
	if c < 0:
		(a, b, c) = (-a, -b, -c)
	if a > b:
		return 'NO'
	if (b - a) % c == 0:
		return 'YES'
	return 'NO'
print(main())


while 1:
	try:
		(a, b, c) = map(int, input().split())
	except:
		break
	if c == 0:
		print('YES') if a == b else print('NO')
	else:
		b -= a
		print('YES') if b % c == 0 and b / c >= 0 else print('NO')


(a, b, c) = map(int, input().split())
s = 0
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif c < 0:
	if a < b:
		print('NO')
	elif abs(a - b) % c == 0:
		print('YES')
	else:
		print('NO')
elif a > b:
	print('NO')
elif abs(a - b) % c == 0:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if c == 0 or a == b:
	print('YES' if a == b else 'NO')
elif a < b and c < 0 or (a > b and c > 0):
	print('NO')
else:
	dist = abs(b - a) if b > a else abs(a - b)
	print('YES' if dist // abs(c) == dist / abs(c) else 'NO')


X = list(map(int, input().split()))
if X[2] == 0 or X[0] == X[1]:
	print('YES' if X[1] == X[0] else 'NO')
	exit()
print('YES' if (X[1] - X[0]) % X[2] == 0 and (X[1] - X[0]) // X[2] > 0 else 'NO')


inp = input().split()
(a, b, c) = (int(inp[0]), int(inp[1]), int(inp[2]))
if a == b:
	print('YES')
	exit(0)
if c == 0 and a != b:
	print('NO')
	exit(0)
if c > 0 and a < b:
	if (b - a) % c == 0:
		print('YES')
	else:
		print('NO')
	exit(0)
if c < 0 and a > b:
	if (b - a) % c == 0:
		print('YES')
	else:
		print('NO')
	exit(0)
print('NO')


(a, b, c) = map(int, input().split())
if c == 0 and a != b:
	print('no')
elif c == 0 and a == b:
	print('yes')
else:
	n = abs((b - a) // c)
	if n * c == b - a:
		print('yes')
	else:
		print('no')


def main():
	inpt = input().split()
	start = int(inpt[0])
	fav = int(inpt[1])
	diff = int(inpt[2])
	if diff == 0:
		if start == fav:
			print('YES')
		else:
			print('NO')
	else:
		y = (fav - start) / diff
		isint = False
		if y == int(y):
			isint = True
		if isint == True:
			if y >= 0:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
main()


(a, b, c) = [int(x) for x in input('').split(' ')]
out = 'NO'
if c != 0:
	if (b - a) / c > 0:
		if (b - a) % c == 0:
			out = 'YES'
if a == b:
	out = 'YES'
print(out)


(a, b, c) = map(int, input().split())

def ispos():
	pos = 0
	if a == b:
		return 1
	if c == 0:
		return 0
	if a < b and c < 0:
		return 0
	if a > b and c > 0:
		return 0
	if (b - a) % c == 0:
		return 1
	else:
		return 0
ans = 'YES' if ispos() == 1 else 'NO'
print(ans)


def infinite(a, b, c):
	if c == 0 and b - a == 0:
		return 'YES'
	elif b - a != 0 and c == 0:
		return 'NO'
	if b - a < 0 and c >= 0:
		return 'NO'
	elif b - a > 0 and c < 0:
		return 'NO'
	if (b - a) % c == 0:
		return 'YES'
	else:
		return 'NO'
(a, b, c) = input().strip().split()
print(infinite(int(a), int(b), int(c)))


import math as m
(a, b, c) = map(int, input().split())
d = 0
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	if c < 0:
		d = a - b
	else:
		d = b - a
	if d < 0 or d % c != 0:
		print('NO')
	else:
		print('YES')


(a, fav, sec) = map(int, input().split())
if a == fav or (sec != 0 and ((fav - a) % sec == 0 and (fav - a) / sec > 0)):
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split(' '))
if c == 0:
	ans = a == b
elif b < a and c > 0:
	ans = False
elif b > a and c < 0:
	ans = False
else:
	ans = (b - a) % c == 0
if ans:
	print('YES')
else:
	print('NO')


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


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)

def ok(a, b, c):
	if c == 0:
		return a == b
	d = b - a
	if c * d < 0:
		return False
	else:
		return (b - a) % c == 0
print('YES' if ok(a, b, c) else 'NO')


abc = list(map(int, input().split()))
difference = abc[2]
start = abc[0]
lookFor = abc[1]
if difference == 0:
	if lookFor == start:
		print('YES')
	else:
		print('NO')
elif difference < 0 and start < lookFor:
	print('NO')
elif difference > 0 and start > lookFor:
	print('NO')
elif start % difference == lookFor % difference:
	print('YES')
else:
	print('NO')


a = input().split()
(a, b, c) = a
a = int(a)
b = int(b)
c = int(c)
if not c:
	if a == b:
		print('YES')
	else:
		print('NO')
elif b % c == a % c and (b >= a and c > 0 or (b <= a and c < 0)):
	print('YES')
else:
	print('NO')


def f(a, b, c):
	if a == b:
		return 'YES'
	elif c == 0:
		return 'NO'
	elif c < 0 and b > a:
		return 'NO'
	elif c > 0 and b < a:
		return 'NO'
	return ['YES', 'NO'][(b - a) % c != 0]
(a, b, c) = map(int, input().split())
print(f(a, b, c))


import sys
(start, value, increment) = map(int, sys.stdin.readline().strip().split())
if start == value:
	print('YES')
	exit()
if value > start and increment > 0 and (value % increment == start % increment):
	print('YES')
	exit()
if value < start and increment < 0 and (value % increment == start % increment):
	print('YES')
	exit()
print('NO')


(a, b, c) = map(int, input().split())
if a == b:
	print('YES')
elif c > 0 and c != 1:
	while a < b:
		a = c + a
	if a == b:
		print('YES')
	else:
		print('NO')
elif c < 0 and c != -1:
	while a > b:
		a = c + a
	if a == b:
		print('YES')
	else:
		print('NO')
elif c == 0:
	print('NO')
elif c == 1 and a < b:
	print('YES')
elif c == -1 and a > b:
	print('YES')
else:
	print('NO')


import sys
Input = sys.stdin.readline
(a, b, c) = map(int, Input().split())
if a is b:
	exit(print('YES'))
z = b - a
if z * c > 0 and z % c == 0:
	exit(print('YES'))
print('NO')


from sys import stdin as Si, maxsize as m
from math import floor as F
from collections import defaultdict as dt
from operator import itemgetter as ig
from math import pi
(a, b, c) = map(int, Si.readline().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif c > 0:
	if (b - (a - c)) % c == 0 and b >= a:
		print('YES')
	else:
		print('NO')
elif c < 0:
	if (b - (a - c)) % c == 0 and b <= a:
		print('YES')
	else:
		print('NO')


(x, n, r) = map(int, input().split())
if n == x:
	print('YES')
elif r == 0:
	print('NO')
elif (n - x) % r == 0 and (n > x and r > 0 or (n < x and r < 0)):
	print('YES')
else:
	print('NO')


import math

def possible(a, b, c):
	if c == 0:
		if b - a == 0:
			return True
		return False
	n = (b - a) / c
	if n >= 0 and (n == math.floor(n) or n == math.ceil(n)):
		return True
	return False
(a, b, c) = map(int, input().split())
if possible(a, b, c):
	print('YES')
else:
	print('NO')


(a, b, c) = list(map(int, input().split()))
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	import math
	if c > 0:
		if b > a:
			k = (b - a) / c
			if math.ceil(k) == math.floor(k):
				print('YES')
			else:
				print('NO')
		elif b == a:
			print('YES')
		else:
			print('NO')
	elif b < a:
		k = (a - b) / c
		if math.ceil(k) == math.floor(k):
			print('YES')
		else:
			print('NO')
	elif b == a:
		print('YES')
	else:
		print('NO')


(a, b, c) = tuple(map(int, input().split()))
if c == 0:
	print('Yes' if a == b else 'No')
elif b % c == a % c and (b == a or (b - a) // abs(b - a) == c // abs(c)):
	print('Yes')
else:
	print('No')


x = input()
(a, b, d) = x.split()
a = int(a)
b = int(b)
d = int(d)
if d == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
elif (b - a) % d == 0 and (b - a) * d >= 0:
	print('YES')
else:
	print('NO')


wt = list(map(int, input().split()))
a = wt[0]
b = wt[1]
c = wt[2]
if c == 0:
	if a != b:
		print('NO')
		quit()
	else:
		print('YES')
		quit()
if c > 0:
	if (b - a) % c == 0 and b > a:
		print('YES')
	elif a == b:
		print('YES')
	else:
		print('NO')
if c < 0:
	if (b - a) % c == 0 and b < a:
		print('YES')
	elif a == b:
		print('YES')
	else:
		print('NO')


def InSequence(a, b, c):
	if c == 0:
		if a == b:
			return 'YES'
		else:
			return 'NO'
	elif c > 0:
		k = (b - a) % c
		if k == 0 and b >= a:
			return 'YES'
		else:
			return 'NO'
	else:
		k = (b - a) % c
		if k == 0 and b <= a:
			return 'YES'
		else:
			return 'NO'
(a, b, c) = [int(x) for x in input().split()]
print(InSequence(a, b, c))


import math

def get_primes(prime_supr):
	is_prime = [0] * 2 + [1] * prime_supr
	for i in range(2, int(math.sqrt(prime_supr)) + 1):
		if is_prime[i]:
			for j in range(i * i, prime_supr + 1, i):
				is_prime[j] = 0
	return is_prime
get_int = lambda : map(int, input().split())
(a, b, c) = get_int()
if c != 0:
	x = (b - a) / c
	print(['YES', 'NO'][int(x) != x or x < 0])
else:
	print(['YES', 'NO'][b != a])


(a, b, cd) = map(int, input().split())
if cd == 0:
	print('YES' if a == b else 'NO')
elif b > a and cd < 0:
	print('NO')
elif b < a and cd > 0:
	print('NO')
else:
	print('YES' if (b - a) % cd == 0 else 'NO')


s = list(map(int, input().split()))
start = s[0]
target = s[1]
diff = s[2]
if diff != 0:
	n = (target - start) / diff
elif start == target:
	n = 0
else:
	n = 0.1
if n >= 0 and n - int(n) == 0:
	print('YES')
else:
	print('NO')


(a, an, d) = [int(j) for j in input().split()]
if d == 0:
	if a == an:
		print('YES')
	else:
		print('NO')
else:
	n = (an - a) / d + 1
	if n > 0 and int(n) == n:
		print('YES')
	else:
		print('NO')


s = input()
s = s.split()
s = list(map(int, s))
a = s[1] - s[0]
b = s[2]
if a * b > 0:
	if a % b == 0:
		print('YES')
	else:
		print('NO')
elif a * b < 0:
	print('NO')
elif a == 0:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if c == 0:
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	(d, r) = divmod(b - a, c)
	if a == b:
		print('YES')
	elif d < 1 or r != 0:
		print('NO')
	else:
		print('YES')


a = [int(i) for i in input().split()]
ans = 'NO'
if a[0] == a[1]:
	ans = 'YES'
elif a[2] != 0:
	if (a[1] - a[0]) / a[2] >= 0:
		if int((a[1] - a[0]) / a[2]) == (a[1] - a[0]) / a[2]:
			ans = 'YES'
print(ans)


(s, n, d) = map(int, input().split())
if n == s:
	print('YES')
elif d != 0 and (n - s) % d == 0 and ((n - s) // d >= 0):
	print('YES')
else:
	print('NO')


import math
(a, b, c) = list(map(int, input().split()))
if b > a and c <= 0 or (b < a and c >= 0):
	print('NO')
elif b == a:
	print('YES')
else:
	print('YES' if abs(b - a) % abs(c) == 0 else 'NO')


def main():
	(a, b, c) = input().split()
	(a, b, c) = (int(a), int(b), int(c))
	if b - a >= 0 and c > 0:
		b -= a
		if b % c == 0:
			print('YES')
		else:
			print('NO')
	elif b - a <= 0 and c < 0:
		b = a - b
		c -= 2 * c
		if b % c == 0:
			print('YES')
		else:
			print('NO')
	elif c == 0:
		if a == b:
			print('YES')
		else:
			print('NO')
	elif b - a <= 0 and c > 0 or (b - a >= 0 and c < 0):
		print('NO')
main()


(n, m, k) = [int(i) for i in input().split()]
if k == 0 and m == n:
	print('YES')
elif k != 0:
	if (m - n) / k == int((m - n) / k) and (m - n) / k >= 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(a, b, c) = list(map(int, input().strip().split()))
if c == 0 and a != b:
	print('NO')
elif c == 0 and a == b:
	print('YES')
elif b - a < 0 and c > 0:
	print('NO')
elif b - a > 0 and c < 0:
	print('NO')
elif b - a > 0 and c < 0 and (abs(b - a) % abs(c) == 0):
	print('YES')
elif b - a > 0 and c < 0 and (abs(b - a) % abs(c) != 0):
	print('NO')
elif (b - a) % c == 0:
	print('YES')
elif (b - a) % c != 0:
	print('NO')


import math
(a, b, c) = map(int, input().split())
if c != 0:
	val = (b - a) / c + 1
	if math.ceil(val) == math.floor(val) and int(val) >= 1:
		print('YES')
	else:
		print('NO')
elif a == b:
	print('YES')
else:
	print('NO')


a = []
for i in input().split():
	a.append(int(i))
if a[2] == 0:
	if a[0] == a[1]:
		print('YES')
		exit()
	else:
		print('NO')
		exit()
if a[0] > a[1] and a[2] > 0 or (a[0] < a[1] and a[2] < 0):
	print('NO')
	exit()
if (a[1] - a[0]) % a[2] == 0:
	print('YES')
	exit()
print('NO')


lis = input().split()
a = int(lis[0])
b = int(lis[1])
c = int(lis[2])
if b - a < 0:
	if c < 0:
		d = -(b - a)
		dc = -c
		if d % dc == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
elif b == a:
	print('YES')
elif c > 0:
	if (b - a) % c == 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


read = [int(x) for x in input().split()]
if read[2] == 0:
	if read[0] == read[1]:
		print('YES')
	else:
		print('NO')
else:
	read[1] -= read[0]
	if read[1] % read[2] == 0 and read[1] / read[2] >= 0:
		print('YES')
	else:
		print('NO')


import sys
ansR = input().split(' ')
a = int(ansR[0])
b = int(ansR[1])
c = int(ansR[2])
b_new = b - a
if b < a and c > 0 or (b > a and c < 0):
	print('NO')
elif b == a:
	print('YES')
elif c == 0:
	print('NO')
elif b_new % c == 0:
	print('YES')
else:
	print('NO')


def fx(a, b, c):
	if c == 0 and a != b or (c > 0 and a > b) or (c < 0 and a < b):
		return print('NO')
	if c == 0 and a == b or (b - a) % c == 0:
		return print('Yes')
	return print('NO')
(a, b, c) = input().split()
fx(int(a), int(b), int(c))


import math
(a, b, c) = map(int, input().split())
r = 0
if c == 0 and b == a:
	print('YES')
	r = 1
if c == 0 and b != a:
	print('NO')
	r = 1
k = 0
if a <= 0 and c < 0 and (b > a) or (a >= 0 and c > 0 and (b < a)):
	print('NO')
	k = 1
if r == 0 and k == 0:
	if b - a + c != 0:
		if (b - a + c) % c == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


(a, b, c) = [int(x) for x in input().split()]
flag = 1
if b > a and c < 0:
	print('NO')
elif b < a and c > 0:
	print('NO')
elif not c == 0 and (b - a) % c == 0:
	print('YES')
elif c == 0 and b == a:
	print('YES')
else:
	print('NO')


from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(1):
	(a, b, c) = M()
	if c == 0 or a == b:
		if a == b:
			print('YES')
		else:
			print('NO')
	else:
		d = abs(a - b)
		if a > b:
			if d % c == 0 and c < 0:
				print('YES')
			else:
				print('NO')
		elif d % c == 0 and c > 0:
			print('YES')
		else:
			print('NO')


def solution675a():
	(a, b, c) = map(int, input().split())
	flag = False
	if c == 0:
		if a == b:
			flag = True
	elif (b - a) % c == 0 and (b - a) * c >= 0:
		flag = True
	print('YES' if flag else 'NO')
solution675a()


s = input('').split(' ')
a = int(s[0])
b = int(s[1])
c = int(s[2])
counter = 0
if c == 0 and b == a:
	print('YES')
elif c == 0 and b != a:
	print('NO')
else:
	max1 = (b - a) / c
	max2 = int(max1)
	if max1 < 0:
		print('NO')
	elif max2 == max1:
		print('YES')
	else:
		print('NO')