#include <bits/stdc++.h>
using namespace std;
int main() {
  int tn, a, d;
  cin >> tn >> a >> d;
  swap(tn, a);
  if (d == 0) {
    if (tn == a)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    exit(0);
  }
  if ((tn - a) % d == 0 && (tn - a) / d > -1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
