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