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