#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int a, b, c;
  cin >> a >> b >> c;
  if (c == 0) {
    if (a != b) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
    return 0;
  }
  long long int mx = (b - a) / c;
  if (mx < 0) {
    cout << "NO" << endl;
    return 0;
  }
  if (a + (mx * c) == b) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
