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