#include <bits/stdc++.h>
using namespace std;
inline long int ABS(long int a) {
  if (a < 0) return (-a);
  return a;
}
inline long int min(long int a, long int b, long int c) {
  return min(a, min(b, c));
}
inline long int max(long int a, long int b, long int c) {
  return max(a, max(b, c));
}
inline long int powmod(long int x, long int n, long int _mod) {
  long int res = 1;
  while (n) {
    if (n & 1) res = (res * x) % _mod;
    x = (x * x) % _mod;
    n >>= 1;
  }
  return res;
}
inline long int gcd(long int a, long int b) {
  long int t;
  while (b) {
    a = a % b;
    t = a;
    a = b;
    b = t;
  }
  return a;
}
inline long int lcm(long int a, long int b) { return a / (gcd(a, b) * b); }
inline int bitCount(unsigned int i) { return __builtin_popcount(i); }
inline void cinarr(long int x[], long int n) {
  for (long int i = 0; i < (n); ++i) cin >> (x[i]);
}
inline void cinvec(vector<long int> &arr, long int n) {
  for (long int i = 0; i < (n); ++i) {
    long int x;
    cin >> (x);
    arr.push_back(x);
  };
}
const int v5 = 100000;
const int v9 = 1000000000;
const int v6 = 1000000;
long int n, m, k, c = 0;
long int a[4000001];
vector<char> ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  if (k == 0 && m == n)
    cout << "YES"
         << "\n";
  else if (k == 0)
    cout << "NO"
         << "\n";
  else if ((m >= n && k >= 0 || m <= n && k <= 0) && (m - n) % k == 0)
    cout << "YES"
         << "\n";
  else
    cout << "NO"
         << "\n";
  return 0;
}
