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