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