#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int a, b, c;
  cin >> a >> b >> c;
  double ans = -1;
  if (c != 0) ans = (b - a) / (double)c;
  if ((ans >= 0 && round(ans) == ans) || (c == 0 && a == b))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
