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