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