#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9 + 7;
const char nl = '\n';
void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((c == 0)) {
    if (a == b) {
      cout << "YES" << nl;
      return;
    } else {
      cout << "NO" << nl;
      return;
    }
  }
  if ((b - a) / c >= 0 and (b - a) % c == 0) {
    cout << "YES" << nl;
  } else {
    cout << "NO" << nl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
