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