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