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