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