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