#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, p, k;
  cin >> a >> b >> c;
  if (c != 0) {
    p = b - a;
    k = p / c;
    if (p % c == 0) {
      if (k >= 0)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    } else
      cout << "NO" << endl;
  } else if (c == 0) {
    if (a == b)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
