#include <bits/stdc++.h>
using namespace std;
long long power(long long aa, long long pp) {
  long long xx = 1, yy = aa % 1000000007;
  while (pp > 0) {
    if (pp & 1) xx = (xx * yy) % 1000000007;
    yy = (yy * yy) % 1000000007;
    pp = pp >> 1;
  }
  return xx % 1000000007;
}
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second < b.second;
}
int xc[4] = {0, 1, 0, -1};
int yc[4] = {1, 0, -1, 0};
int main() {
  ios_base::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  if (c == 0) {
    if (a == b)
      cout << "YES";
    else
      cout << "NO";
  } else if (c > 0) {
    if (a > b)
      cout << "NO";
    else {
      if ((b - a) % c == 0)
        cout << "YES";
      else
        cout << "NO";
    }
  } else {
    if (a < b)
      cout << "NO";
    else {
      if ((a - b) % c == 0)
        cout << "YES";
      else
        cout << "NO";
    }
  }
  return 0;
}
