#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long int a, b, c;
  cin >> a >> b >> c;
  if (c == 0) {
    if (a == b)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  float ans = (float)(b - a) / c;
  long int temp = (b - a) % c;
  if (temp == 0 && ans >= 0) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
