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