#include <bits/stdc++.h>
using namespace std;
bool isPosInt(double n) { return (n - (double)((int)n) == 0.0 && n >= 0.0); }
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  double i;
  if (c != 0.0) i = (b - a) / c;
  if ((c == 0.0 && a == b) || isPosInt(i))
    cout << "YES";
  else
    cout << "NO";
}
